centos7 安裝cups+smb共享打印機

yum  install  -y cups samba
vim /etc/cups/cupsd.conf
Listen 0.0.0.0:631                    #0.0.0.0表示監聽所有ip
Listen /var/run/cups/cups.sock
Browsing On
BrowseLocalProtocols dnssd
DefaultAuthType Basic
WebInterface Yes
<Location />
  # Restrict access to the server...
  #Order allow,deny
  Order deny,allow
deny all
allow from 192.168.5.0/24             #允許訪問服務頁面ip段或ip
</Location>
<Location /admin>
  # Restrict access to the admin pages...
  #Order allow,deny
  Order deny,allow
deny all
allow from 192.168.5.0/24              #允許訪問管理頁面ip段或ip
</Location>
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM

這裏我關閉selinux  和 firewalld

systemctl stop firewalld.service
systemctl disable firewalld.service
setenforce 0
vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled                                             #永久關閉
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

配置smb

vim /etc/samba/smb.conf
[global]
	workgroup = WORKGROUP                               #工作組
	security = user                                     #驗證方式
        interfaces = lo  192.168.5.209/24 192.168.0.209/24  #samba 監聽ip
	passdb backend = tdbsam
        server string = Samba Server%v                      
	printing = cups              #打印機
	printcap name = cups         #名稱
        netbios name = centos
	load printers = yes          #加載打印
	cups options = raw
        map to guest = bad user      #匿名登錄
[homes]
	comment = Home Directories
	valid users = %S, %D%w%S
	browseable = No
	read only = No
	inherit acls = Yes

[printers]
	comment = All Printers
	path = /var/spool/samba
	printable = Yes
	create mask = 0600
	browseable = No
        writable = no
        guest ok =yes

[print$]
	comment = Printer Drivers
	path = /var/lib/samba/drivers
	write list = root
	create mask = 0664
	directory mask = 0775

[Public]                     #公共文件夾
        path = /data/public
        writable = yes
        browsable = yes
        guest ok = yes
        guest only = yes
        create mode = 0777
        directory mode = 0777

啓動服務

systemctl start smb.service
systemctl start cups.service
systemctl enable smb.service
systemctl enable cups.service

若有其他問題可試試

systemctl start smb nmb

添加打印機

http://ip:631

然後測試


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章