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
然后测试
时间: 2024-11-14 12:29:53