部署samba
# 安装samba包 yum -y install samba # 创建系统用户 useradd ops -g ops -s /sbin/nologin -M # 创建samba用户 smbpasswd -a ops # 编辑samba文件 vim /etc/samba/smb.conf [global] workgroup = 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 # 定义一个共享 [public] comment=code_share path=/data/share # 目录路径 public = no # 不公共 #valid users = test # 设置该选项只有在这里的用户才能访问 browseable = yes # 是否可以浏览 writable = yes # 是否可以写入 create mask = 0644 # 创建文件权限 # 重启 /bin/systemctl restart smb.service # 清理缓存 net use \\ip /del 可以在cmd命令行里面填写\\192.168.10.128就可以访问