建立组账户tech、创建员工账号jiashenzhen chenlongfei
[root@localhost ~]# groupadd tech[root@localhost ~]# useradd -g tech chenlongfei[root@localhost ~]# useradd -g tech jiashenzhen[root@localhost ~]# useradd common2.创建存放共享资源的文件夹/home/samba/data,以及子目录public tech jiashenzhen chenlongfei[root@localhost share]# mkdir public tech jiashenzhen chenlongfei[root@localhost share]# chown root:tech public [root@localhost share]# chown root:tech tech[root@localhost share]# chown jiashenzhen:root jiashenzhen[root@localhost share]# chown chenlongfei:root chenlongfei[root@localhost share]# chmod -R 700 jiashenzhen[root@localhost share]# chmod -R 700 chenlongfei[root@localhost share]# chmod -R 775 public[root@localhost share]# chmod -R 770 tech yum install samba samba-client samba-swat3.创建共享用户useradd commonpdbedit -a -u commonuseradd jiashenzhenpdbedit -a -u jiashenzhenuseradd chenlongfeipdbedit -a -u chenlongfeiuseradd rootpdbedit -a -u root[root@localhost share]# pdbedit -L(验证账户)jiashenzhen:501:root:0:rootchenlongfei:502:common:503:4.修改smb.conf文件,添加共享设置,并启动smb服务[root@localhost 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子配置文件[root@rd 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[root@rd 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 启动服务/etc/init.d/smb start/etc/init.d/nmb start客户端访问:smbclient //172.23.145.41/tech -U jiashenzhen客户端挂载:mount -t cifs //172.23.145.41/tech /home/172.23.145.41 -o username=jiashenzhen,password=jiashenzhen