We can use Samba to achieve access to windows and Linux shared folders.
1. Install samba
>sudo apt-get install samba
>sudo apt-get install smbclient
2. Modify configure file
>sudo vim /etc/samba/smb.conf
in the end of file,add the following contents:
[share]
comment = Shared Folder require password
path = /home/feliex/workspace
public = yes
writable = yes
; valid users = feliex
create mask = 0777
directory mask = 0777
; force user = nobody
; force group = nogroup
available = yes
browseable = yes
这是针对所有用户都用效的,针对特定用户有效还需要做一些设置。
3. Set user name and password
>sudo smbpasswd -a username
New SMB password:
Retype new SMB password:
4. Restart samba server
>sudo /etc/init.d/samba restart
5. Accessing share folders under windows
(1) 打开“计算机”
(2) 右键选择“添加一个网络位置”
(3) 输入Ubuntu server的共享位置”\\ip地址\share”
6.Accessing share folders under linux
smbclient -L 192.168.1.102 -U Administrator #查看共享了那些目录,由此知道主机名
smbclient //192.168.1.102/Users -U Administrator #输入windows密码即可进入
//直接挂载windows共享目录
sudo mount -t smbfs -o username=feliex,password=123456 //FELIEX-PC/system /mnt/win/
或者:
sudo mount -t smbfs -o username=feliex,password=123456 //192.168.16.1/system /mnt/win/
或者:
sudo mount -t smbfs -o username=feliex,password=123456,ip=192.168.16.1