$ cat /etc/samba/smb.conf [global] workgroup = WORKGROUP security = user map to guest = bad user [Anonymous] comment = Anonymous File Server Share path = /home/data/samba/anonymous browsable = yes writeable = yes guest ok = yes read only = no public = yes
启动服务且设置开机自启
1 2 3 4 5 6
$ systemctl enable smb Created symlink from /etc/systemd/system/multi-user.target.wants/smb.service to /usr/lib/systemd/system/smb.service. $ systemctl enable nmb Created symlink from /etc/systemd/system/multi-user.target.wants/nmb.service to /usr/lib/systemd/system/nmb.service. $ systemctl restart smb $ systemctl restart nmb
私密文件夹共享
添加一个samba组,再添加用户到该组内
1 2 3 4 5 6
$ groupadd sambagroup $ usermod leon -aG sambagroup $ smbpasswd -a leon New SMB password: Retype new SMB password: Added user leon.