前期环境的检查准备工作: 查看防火墙是否关闭,没关闭关闭防火墙
[root@localhost ~]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination [root@localhost ~]# iptables -F [root@localhost ~]# systemctl stop firewalld1.安装sumba服务
[root@localhost ~]# yum install samba2.配置主配置文件 默认主配置文件:/etc/samba/smb.conf
[root@localhost chaoge]# vim /etc/samba/smb.conf [global] ##########全局 workgroup = SAMBA #########Samba服务器加入的工作组名 security = user passdb backend = tdbsam printing = cups printcap name = cups load printers = yes cups options = raw [homes] comment = Home Directories valid users = %S, %D%w%S browseable = No read only = No inherit acls = Yes [printers] comment = All Printers path = /var/tmp printable = Yes create mask = 0600 browseable = No [print$] comment = Printer Drivers path = /var/lib/samba/drivers write list = @printadmin root force group = @printadmin create mask = 0664 directory mask = 0775 [chaoge] comment = This is test configure path = /home/chaoge ####共享目录路径 public = No ####共享是否允许guest账号访问 writable = Yes ####共享路径是否可写 guest ok = Yes ####共享是否允许guest账号访问3.创建用户数据 注:samba创建的用户数据库必须在当前系统中创在的用户 创建chaoge用户,密码为666666
[root@localhost ~]# id chaoge id: chaoge: no such user [root@localhost ~]# useradd chaoge [root@localhost ~]# id chaoge uid=1005(chaoge) gid=1005(chaoge) groups=1005(chaoge) [root@localhost ~]# pdbedit -a -u chaoge4.重启smb服务,检查是否允许smb的端口
[root@localhost ~]# systemctl restart smb [root@localhost ~]# netstat -tunlp | grep smb tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 1815/smbd tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 1815/smbd tcp6 0 0 :::445 :::* LISTEN 1815/smbd tcp6 0 0 :::139 :::* LISTEN 1815/smbd用win系统或者mac就可以进行远程连接操作了。