1、简单的安装:
sudo apt-get install samba sudo apt-get install smbfs
2、建立共享文件夹,并设置权限
mkdir /home/fredric/share chmod 777 /home/fredric/share
3、smb.conf文件配置
sudo gedit /etc/samba/smb.conf
找到“security = user”这行,修改为
security = user username map = /etc/samba/smbusers
找到“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/fredric/share public = yes writable = yes valid users = new create mask = 0700 directory mask = 0700 force user = nobody force group = nogroup available = yes browseable = yes
其中 valid users 的值为Win用户和Linux交互的用户名。
新建new用户,并设定密码
sudo useradd new sudo smbpasswd -a new
新建文件,
sudo gedit /etc/samba/smbusers
加入内容:
new = “network username”
测试:
sudo testparm
重启Samba
sudo service smbd restart
3、Win7与Linux交互
点击计算机,映射网络驱动器,输入servername/share,并输入用户名new和密码,即可!