1.創建共享文件夾:
1.ubuntu12.04 版本:
$ sudo apt-get install samba4
$ sudo mkdir -p /home/share //創建共享文件夾
$ sudo chmod 777 /home/share
$ sudo cp /etc/samba/smb.conf /etc/samba/smb-bk.conf
$ sudo vim /etc/samba/smb.conf //編輯samba配置文件,添加如下代碼
....
# ----------------------- Standalone Server Options ------------------------
#
# Scurity can be set to user, share(deprecated) or server(deprecated)
#
# Backend to store user information in. New installations should
# use either tdbsam or ldapsam. smbpasswd is available for backwards
# compatibility. tdbsam requires no further configuration.
# security = user
#免密碼訪問
security = share
....
[share]
path = /home/android8/Documents
available = yes
browseable = yes
public = yes
writable = yes
[zhanglei_share]
path = /home/zhanglei/share
available = yes
browseable = yes
public = yes
writable = yes
$ sudo /etc/init.d/smbd restart
2.ubuntu14.04版本:
$ sudo apt-get install samba samba-common
$ mkdir -p share
$ sudo chown nobody:nogroup ./share
$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bk
$ sudo vim /etc/samba/smb.conf
[Anonymous]
comment = Anonymous share access
path = /shares/anonymous
browsable = yes
writable = yes
guest ok = yes
read only = no
force user = nobody
force group = nogroup
$ sudo service smbd restart
2:訪問共享文件夾
ubuntu 12.04LTS已經不支持smbfs文件系統,所以不能用mount -smbfs 來映射windows共享文件夾。
常見有兩種方法
1.terminal下
mount //192.168.0.88/share -o user=DOMIAN\\xxx,pass=xxx /mnt/share
注:其中192.168.0.88是windows主機名稱,share是其共享文件夾名。domain是windows主機域名,必須大寫。
2. GUI方式
主文件夾下,按Ctrl+l,輸入smb://192.168.0.88,按提示輸入登陸賬戶,然後就可以訪問了。