1、安装samba服务: sudo apt-get install samba

 

2、sudo gedit /etc/samba/smb.conf 编辑smb.conf 文件. (注意备份先)

 

3、找到; security = user那一行

 

替换为

security = user

username map = /etc/samba/smbusers

 

找到[global]

把workgroup = MSHOME改为

 

workgroup = WORKGROUP

display charset = UTF-8

unix charset = UTF-8

dos charset = cp936

 

然后在配置文件最后面加入

 

[Share]

comment = Shared Folder with username and password

path = /home/lsk/test

public = yes

writable = yes

valid users = username

create mask = 0700

directory mask = 0700

force user = nobody

force group = nogroup

available = yes

browseable = yes

 

[Share]是在局域网当中共享的文件夹名称

valid users是允许网络用户帐户

 

4、sudo gedit /etc/samba/smbusers增加允许访问的用户帐户

在smbusers 中添加

username = "network username"

 

其中user就是刚才smb.conf 当中那个user

 

5、如果系统当中没有user此用户则添加.

sudo useradd username

编辑用户密码

sudo smbpasswd -a username

删除用户

sudo smbpasswd -x username