安装samba


sudo apt-get install samba


在/etc/samba/smb.conf增加配置


[liuxiaokun]
comment = Shared Folder require password
path = /home/liuxiaokun
public = yes
writable = yes
printable = no
valid users = liuxiaokun
create mask = 0644
directory mask = 0755
#force user = nobody
#force group = nogroup
available = yes
browseable = yes
#oplocks = no
#level2 oplocks = no


配置samba用户密码


$ sudo smbpasswd -a liuxiaokun
$ sudo /etc/init.d/samba reload


使用Windows访问samba共享目录


按Win + R键,然后输入 \192.168.229.154\liuxiaokun

TIPS:如果提示“无法访问。……不允许一个用户用一个以上用户名与服务器或共享资源的多重连接。……”,需要在CMD命令行执行命令清除其他连接:

> net use * /del /y

再重新连接