//linux rw windows share folderlinux
temporary mount, lose this mount point if restartios
sudo mkdir /home/sharefolderubuntu
sudo mount -t cifs -o username=username,password=pwd //ip/sharefoldername /home/sharefolderwindows
2. auto mount point when system start服務器
sudo gedit /etc/fstabide
add 2 line:this
//ip/sharename /home/sharefolder cifs defaults,username=usrname,password=share 0 2spa
or(if everyone is ok)rest
//ip/sharename /home/sharefolder cifs defaults 0 2 orm
//ip/sharename /home/sharefolder nfs defaults 0 2
3.smbclient
sudo apt-get install smbclient
smbclinet --user=username //ip/sharename
Enter share's password:(enter password)
//operae like ftp command
smb:/>help
exit get getfacl geteas hardlink help history iosize lcd link
smb:/help command //details
//windows rw linux share folder
//install samba ,ubuntu16 share folder for windows user
sudo apt-get install samba
sudo apt-get install smbclient
sudo mkdir -p /home/sharefolder
sudo chmod 777 /home/sharefolder //sharefolder permissions. default is 755 . Owner can write only
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak //backup before edit
sudo gedit /etc/samba/smb.conf
//config smb.conf
usershare owner only = false //add this line after Global Setting
//add follow at bottom of smb.conf
[sharefolder]
path = /home/sharefolder
browseable = yes
write = yes
public = yes
comment = smb share folder test
//restart samba service
sudo service smbd restart
//client test
smbclient -L //localhost/sharefolder //linux client test
\\ip\sharefolder //windows client test
//User access control
sudo useradd username //a1 , a2 , b1, b2 , c1,c2
sudo groupadd groupname //aa, bb, cc
sudo usermod -g groupname username //(a1,a2->aa)(b1,b2->bb)(c1,c2->cc)
sudo mkdir /home/share/foldera //foldera,folderb,folderc folderd,foldere
sudo chomd 777 /home/share/*
sudo gedit /etc/samba/smb.conf
[sharefoldera]
comment=sharefoldera,(r)a1,b1,@aa,(w)@aa
path=/home/share/foldera
public=no
valid users= a1,b1,@aa
write list = @aa
[sharefolderb]
comment=sharefolderb,(r)a1,@cc,@bb(w)@bb
path=/home/share/folderb
public=no
valid users= a1,@cc,@bb
write list = @bb
[sharefolderc]
comment=sharefolderc,(r)@bb,@cc(w)@cc
path=/home/share/folderc
public=no
valid users = @bb,@cc
write list = @cc
[sharefolderd]
comment=sharefolderd,all users read only
path=/home/share/folderd
public = yes
readonly = yes
[sharefoldere]
comment=sharefoldere,(rw)all user
path=/home/share/foldere
public = yes
writable = yes
//share folder configuration
[share] # 該共享的共享名
comment = smb share test # 該共享的備註
path = /home/share # 共享路徑
allow hosts = host(subnet) # 設置該Samba服務器容許的工做組或者域
deny hosts = host(subnet) # 設置該Samba服務器拒絕的工做組或者域
available = yes|no # 設置該共享目錄是否可用
browseable = yes|no # 設置該共享目錄是否可顯示
writable = yes|no # 指定了這個目錄缺省是否可寫,也能夠用readonly = no來設置可寫
public = yes|no # 指明該共享資源是否能給遊客賬號訪問,guest ok = yes其實和public = yes是同樣的
user = user, @group # user設置全部可能使用該共享資源的用戶,也能夠用@group表明group這個組的全部成員,不一樣的項目之間用空格或者逗號隔開
valid users = user, @group # 指定可以使用該共享資源的用戶和組
invalid users = user, @group # 指定不可以使用該共享資源的用戶和組
read list = user, @group # 指定只能讀取該共享資源的用戶和組
write list = user, @group # 指定能讀取和寫該共享資源的用戶和組
admin list = user, @group # 指定能管理該共享資源(包括讀寫和權限賦予等)的用戶和組
hide dot files = yes|no # 指明是否像UNIX那樣隱藏以「.」號開頭的文件
create mode = 0755 # 指明新創建的文件的屬性,通常是0755
directory mode = 0755 # 指明新創建的目錄的屬性,通常是0755
sync always = yes|no # 指明對該共享資源進行寫操做後是否進行同步操做
short preserve case = yes|no # 指明是否區分文件名大小寫
preserve case = yes|no # 指明是否保持大小寫
case sensitive = yes|no # 指明是否對大小寫敏感,通常選no,否則可能引發錯誤
mangle case = yes|no # 指明混合大小寫
default case = upper|lower # 指明缺省的文件名是所有大寫仍是小寫
force user = testuser # 強制把創建文件的屬主是誰。若是我有一個目錄,讓guest能夠寫,那麼guest就能夠刪除,若是我用force user= testuser強制創建文件的屬主是testuser,同時限制create mask = 0755,這樣guest就不能刪除了
wide links = yes|no # 指明是否容許共享外符號鏈接,好比共享資源裏面有個鏈接指向非共享資源裏面的文件或者目錄,若是設置wide links = no將使該鏈接不可用
max connections = 100 # 設定最大同時鏈接數
delete readonly = yes|no # 指明可否刪除共享資源裏面已經被定義爲只讀的文件