重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
//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 # 指明能否删除共享资源里面已经被定义为只读的文件