1.安装Samba
yum -y install samba samba-client samba-common
2.添加要使用的账号
useradd -s /sbin/nologin username smbpasswd -a username
3.创建目录
mkdir -p /data/samba/username chmod 777 /data/samba/username
4.修改配置文件
vim /etc/samba/smb.conf # 修改homes 添加 username模块 [homes] comment = Home Directories valid users = %S, %D%w%S browseable = No read only = No inherit acls = Yes [username] comment = username path = /data/samba/username # path 是要共享的目录 public = no valid users = @username write list = usernmame printable = no
5.启动服务
systemctl start/stop/restart/enable/status smb # 启动/停止/重启/设置开机自启动/查看状态6.添加位置
在windows中 输入以下地址即可 \\192.168.1.107