一、环境
redhat 6.4 64bit
samba-winbind-clients-3.6.9-151.el6.x86_64
samba-client-3.6.9-151.el6.x86_64
samba-common-3.6.9-151.el6.x86_64
samba4-libs-4.0.0-55.el6.rc4.x86_64
samba-3.6.9-151.el6.x86_64
samba-winbind-3.6.9-151.el6.x86_64
cups-libs-1.4.2-48.el6_3.3.x86_64
cups-pk-helper-0.0.4-12.el6.x86_64
cups-lpd-1.4.2-48.el6_3.3.x86_64
gutenprint-cups-5.2.5-2.el6.x86_64
cups-1.4.2-48.el6_3.3.x86_64
打印机
HP LaseJet P2015 PCi
目标是用linux做打印服务器,给大家共享打印机
二、配置cups
service cups start
chkconfig --level 2345 cpus on
默认在http://127.0.0.1:631或者http://localhost:631上可以方面到打印管理界面。通过这个界面添加一个打印机
如果不好用查看cups配置文件
/etc/cups/cupsd.conf。
修改配置文件cups.conf,界面也有修改功能,不过没有尝试。
# Allow remote access
Port 631 #默认是Port localhost:631 ,所以我的默认只能用http://localhost:631。修改后可以远程访问
Listen /var/run/cups/cups.sock
# Enable printer sharing and shared printers.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseRemoteProtocols CUPS
BrowseAddress @LOCAL
BrowseLocalProtocols cups
DefaultAuthType Basic
# Allow shared printing and remote administration... 允许哪些地址方面这个打印机
Order allow,deny
Deny From All
Allow From 127.0.0.1
Allow From 22.11.63.0/24
Allow From 22.11.71.0/24
# Allow remote administration... 允许哪些地址方面这个打印机管理界面。
Order allow,deny
Deny From All
Allow From 127.0.0.1
Allow From 22.11.63.0/24
Allow From 22.11.71.0/24
重新启动cups
service cups restart
三、配置samba
1、修改/etc/samba/smb.conf
[global]
load printers = yes
cups options = raw
printcap name = /etc/printcap
#obtain list of printers automatically on SystemV
#printcap name = HP2015 #注意同名变量只能有一次,这个默认配置文件有问题。我查了好些次才发现这个和上面重名
printing = cups
security = user
passdb backend = tdbsam
[printers]
comment = All Printers
path = /var/spool/samba
browseable = yes
public = yes
printable = yes
2、重新启动smb
service smb restart
chkconfig --level 2345 smb on
3、增加用户
useradd fudl #注意一定要先增加os用户,否则smbpasswd报错
passwd fudl
smbpasswd -a fudl 增加samba用户
这个密码可以和os用户密码不同。
四、问题诊断
1、首先在本地测试打印机是否可用。
2、本地测试samba共享
su - fudl
smbclient -L \\22.11.63.11 这里没有指定用户名,那么就是fudl。这是一个os用户,并且使用smbpasswb设置了samba密码。
这个命令应该能够列出打印机,否则你的设置肯定不对。
3、注意防火墙、selinux设置是否正确,我没有仔细看,直接关闭了。内网也用不上。
4、问题分析,如果以上修改还不行。呵呵!只能看日志了
samba日志路径配置在/etc/samba/smb.conf下面,默认路径是
/var/log/samba/smbd.log smb守护进程日志,一般用来发行配置错误。
/var/log/samba/log.* 远程访问日志,*号一般是机器名称或者IP,可以用来发现用户设置方面的错误
/var/log/cups/access_log
/var/log/cups/error_log
/var/log/cups/page_log
配置文件样例 samba-printer-cups.rar
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15711267/viewspace-1079492/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/15711267/viewspace-1079492/