我有一台旧台式机,我想将其设置为家庭备份/打印服务器。备份很简单,但打印时遇到了问题。打印机连接到运行 Ubuntu Server 9.10(无 gui)的服务器。如果我通过http://主机名:631/打印机/,我可以打印测试页,因此我知道打印机正在工作;但是,我在 Windows 上没有找到合适的打印机。
通过 \hostname\ 浏览时,Windows 可以看到打印机,但我无法连接。Windows 显示“Windows 无法连接到打印机”,但没有说明原因。
有什么建议么?
从/etc/samba/smb.conf:
[global]
workgroup = WORKGROUP
dns proxy = no
security = user
username map = /etc/samba/smbusers
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
load printers = yes
printing = cups
printcap name = cups
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
writable = no
printable = yes
guest ok = yes
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = yes
从/etc/cups/cupsd.conf:
LogLevel warn
SystemGroup lpadmin
Port 631
Listen /var/run/cups/cups.sock
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseRemoteProtocols CUPS
BrowseAddress @LOCAL
BrowseLocalProtocols CUPS dnssd
DefaultAuthType Basic
<Location />
Order allow,deny
Allow all
</Location>
<Location /admin>
Order allow,deny
Allow all
</Location>
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow all
</Location>
<Policy default>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job CUPS-Get-Document>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
<Policy authenticated>
<Limit Create-Job Print-Job Print-URI>
AuthType Default
Order deny,allow
</Limit>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job CUPS-Get-Document>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Cancel-Job CUPS-Authenticate-Job>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
答案1
您需要将访客用户添加到 samba 密码数据库。通常,这是通过guest
在 samba 配置文件中映射到 UNIX 现有用户来完成的;通过组授予该用户打印权限;然后您应该能够通过 URI 访问打印机\\server\
。
您还可以尝试在添加网络驱动器时提供用户名(即管理员)来连接到服务器。
答案2
从 Windows 打印到 CUPS 服务器时,我发现使用 IPP(Internet 打印协议)比 SMB 更可靠。
在 Windows 中,添加新打印机时,选择“网络打印机”,然后选择“连接到 Internet 或内部网上的打印机”。
当它要求输入打印机 URL 时,输入 http://hostname:631/printers/printername(从此 URL 中删除空格,我添加空格是因为 Superuser.com 对新用户的超链接数限制)。
然后照常进行。
另请参阅此 3 部分指南,了解如何设置 CUPS 服务器、打印机驱动程序和 Windows 客户端:
答案3
答案4
如果打印机在 Linux 下工作,那么 Linux 可能只是一个幌子?
我读了一篇关于微软技术网来自遇到与您类似问题的人。假设 Samba 和 Linux 在此情况下只是个幌子,那么可能值得尝试建议的解决方案。