目的:快速的配置一个win可访问的linux共享文件服务器。并且可以控制每个目录的访问权限。
1:安装
sudo apt-get install samba
2:创建密码文件
sudo touch /etc/samba/smbpasswd
3:修改/etc/samba/smb.conf的用户认证密码文件位置
#passdb backend = tdbsam
#obey pam restrictions = yes
#guest account = nobody
#invalid users = root
smb passwd file = /etc/samba/smbpasswd
4:新建用户
sudo smbpasswd -a newuser(注意,该用户必须为linux已存在用户)
5:创建共享文件夹,修改/etc/samba/smb.conf,在文件尾加入
[displayname]
path=/path/to/sharefolder(注意,该文件夹newuser需要有读写权限)
comment=somecomments
available=yes
browsable=yes
public=yes
writeable=no
valid users=newuser anotheruser
write list=newuser
则该文件夹/path/to/sharefolder可被newuser读写,anotheruser可读
Filed under: Tips — wangyingqi @ 1:45 pm Comments (2424)