ref: http://blog.csdn.net/chenyufei1013/article/details/33716845

安装samba:

[plain] view plain copy

  1. sudo apt-get install samba samba-client

 

添加samba用户:

  1. sudo smbpasswd -a yufei

修改samba配置文件:

  1. sudo vim /etc/samba/smb.conf

设置共享的安全级别为user级:

  1. [global]
  2. security=user

创建共享目录:

  1. [workspace]    注明:workspace即为共享的目录名
  2. path=/home/yufei/workspace
  3. valid users=yufei
  4. public=no
  5. writeable=yes

 

sudo smbpasswd -a yufei

重启samba:

  1. sudo /etc/init.d/smbd restart
  2. test: smbclient -L //localhost/share
  3. test:smbclient //192.168.100.201/smb2 -U yufei

linux 下自动配置挂载:

mount -t cifs -o username=user1 //192.168.100.201/smb1 /mnt/smb1

vi /etc/fstab 添加如下两行

//192.168.100.201/smb1 /mnt/smb1