您好,登錄后才能下訂單哦!
//linux rw windows share folder
temporary mount, lose this mount point if restart
sudo mkdir /home/sharefolder
sudo mount -t cifs -o username=username,password=pwd //ip/sharefoldername /home/sharefolder
2. auto mount point when system start
sudo gedit /etc/fstab
add 2 line:
//ip/sharename /home/sharefolder cifs defaults,username=usrname,password=share 0 2
or(if everyone is ok)
//ip/sharename /home/sharefolder cifs defaults 0 2
//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 # 指明能否刪除共享資源里面已經被定義為只讀的文件
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。