1安装samba
$sudo apt-get install samba #主程序包
$sudo apt-get install smbfs #文件系统挂载或卸载工
2授权要通过samba共享 文件夹
$chmod 777 /home/用户名/文件夹路径
3 备份并编辑smb.conf文件
$sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
找到关键字
# security = user
在下面添加
security = user
username map = /etc/samba/smbusers
然后在文件末尾追加
[文件夹名称]comment = Shared Folder with username and password
path = /home/用户名/文件夹名称
public = yes
writable = yes
valid users = 用户名
create mask = 0700
directory mask = 0700
force user = nobody
force group = nogroup
available = yes
browseable = yes
找到[global]
在其后追加
workgroup = MSHOM
display charset = UTF-8
unix charset = UTF-8
dos charset = cp936
4给用户设置samba远程访问密码$sudo gedit /etc/samba/smbusers
在新建立的文件内加入下面这一行并保存
messcode= "network username"
$sudo smbpasswd -a 用户名
5重新启动samba
$sudo testparm
$sudo service smbd restart
重启Ubuntu
7在windows下调用命令行输入\\ubuntu ip既可