Set up a group account tech, create an employee account Jiashenzhen Chenlongfei
[Email protected] ~]# Groupadd Tech
[Email protected] ~]# useradd-g Tech Chenlongfei
[Email protected] ~]# useradd-g Tech Jiashenzhen
[Email protected] ~]# Useradd common
2. Create a folder that holds shared resources/home/samba/data, and subdirectories public tech Jiashenzhen Chenlongfei
[Email protected] share]# mkdir public tech Jiashenzhen Chenlongfei
[Email protected] share]# chown Root:tech Public
[Email protected] share]# Chown Root:tech Tech
[Email protected] share]# chown jiashenzhen:root jiashenzhen
[Email protected] share]# chown chenlongfei:root Chenlongfei
[Email protected] share]# chmod-r Jiashenzhen
[Email protected] share]# chmod-r Chenlongfei
[Email protected] share]# chmod-r 775 Public
[Email protected] share]# Chmod-r 770 Tech
3. Create a shared user
Useradd Common
Pdbedit-a-U Common
Useradd Jiashenzhen
Pdbedit-a-U jiashenzhen
Useradd Chenlongfei
Pdbedit-a-U Chenlongfei
Useradd Root
Pdbedit-a-U Root
[[email protected] share]# pdbedit-l (verify account)
jiashenzhen:501:
Root:0:root
chenlongfei:502:
common:503:
4. Modify the smb.conf file, add sharing settings, and start the SMB service
[Email protected] share]# vi/etc/samba/smb.conf
[Global]
Workgroup = MyGroup
Server string = Samba Server Version%v
Config file =/etc/samba/smb.conf.%u
Log file =/var/log/samba/log.%m
Max log size = 50
Security = User
Passdb backend = Tdbsam
Load printers = yes
Cups options = raw
[Homes]
Comment = Home directories
Path =/home/samba/data/home
browseable = yes
writable = yes
Write list = root, @tech
[Public]
Comment = Public
Path =/home/samba/data/public
browseable = yes
writable = yes
Valid users = root, @tech, common
Write list = root, @tech
Directory mask = 774
Create mask = 775
[Tech]
Comment = Technology data
Path =/home/samba/data/tech
browseable = yes
Guest OK = No
writable = no
Valid users = root, @tech
Write list = root, @tech
Directory mask = 0774
Create mask = 0660
[Jiashenzhen]
Comment = Chenlongfei data
Path =/home/samba/data/jiashenzhen
browseable = No
Guest OK = No
writable = no
Valid users = Jiashenzhen
Write list = Jiashenzhen
Directory mask = 0700
Create mask = 0700
[Chenlongfei]
Comment = Chenlongfei data
Path =/home/samba/data/chenlongfei
browseable = No
Guest OK = No
writable = no
Valid users = Chenlongfei
Write list = Chenlongfei
Directory mask = 0700
Create mask = 0700
Child configuration file
[Email protected] samba]# egrep-v "^;|#" Smb.conf.jiashenzhen
[Global]
Workgroup = MyGroup
Server string = Samba Server Version%v
Log file =/var/log/samba/log.%m
Max log size = 50
Security = User
Passdb backend = Tdbsam
Load printers = yes
Cups options = raw
[Public]
Comment = Home directories
Path =/home/samba/data/public
browseable = yes
writable = yes
Valid users = root, @tech
Write list = root, @tech
Directory mask = 0774
Create mask = 0660
[Tech]
Comment = Technology data
Path =/home/samba/data/tech
browseable = yes
Guest OK = No
writable = no
Valid users = root, @tech
Write list = root, @tech
Directory mask = 0774
Create mask = 0660
[Jiashenzhen]
Comment = Jiashenzhen data
Path =/home/samba/data/jiashenzhen
Guest OK = No
writable = no
Valid users = Jiashenzhen
Write list = Jiashenzhen
Directory mask = 0700
Create mask = 0700
[Email protected] samba]# egrep-v "^;|#" Smb.conf.chenlongfei
[Global]
Workgroup = MyGroup
Server string = Samba Server Version%v
Log file =/var/log/samba/log.%m
Max log size = 50
Security = User
Passdb backend = Tdbsam
Load printers = yes
Cups options = raw
[Homes]
Comment = Home directories
Path =/home/samba/data/home
browseable = yes
writable = yes
Write list = root, @tech
[Public]
Comment = Public
Path =/home/samba/data/public
browseable = yes
writable = yes
Valid users = root, @tech
Write list = root, @tech
Directory mask = 0774
Create mask = 0660
[Tech]
Comment = Technology data
Path =/home/samba/data/tech
browseable = yes
Guest OK = No
writable = no
Valid users = root, @tech
Write list = root, @tech
Directory mask = 0774
Create mask = 0660
[Chenlongfei]
Comment = Chenlongfei data
Path =/home/samba/data/chenlongfei
Guest OK = No
writable = no
Valid users = Chenlongfei
Write list = Chenlongfei
Directory mask = 0700
Create mask = 0700
Start the service
/ETC/INIT.D/SMB start
/ETC/INIT.D/NMB start
Client Access:
Smbclient//172.23.145.41/tech-u Jiashenzhen
Client Mount:
Mount-t CIFS//172.23.145.41/tech/home/172.23.145.41-o Username=jiashenzhen,password=jiashenzhen
This article is from the "jiazheming" blog, make sure to keep this source http://8888866666.blog.51cto.com/6988153/1792530
Deploying a Samba Shared server