1. Requirements:
Establish two users (zx,zxadmin), zxadmin can access all directories, ZX can only access the specified directory.
2. Install SMB
[email protected]/]# Yum install samba-y
3. Create user (Zxamin primary account, ZX as General account, ZX belongs to Zxadmin Group), and convert account to SMB user
[Email protected]//]# useradd-g zxadmin ZX
[Email protected]/]# smbpasswd-new/]# smbpasswd-new SMB password: Added user ZX.
4. Create the SMB directory (the SMB directory belongs to the Zxadmin user, and set the SMB directory permission to 770)
[[email protected]/]# mkdir/data[[email protected] data]# mkdir/data/smb1[[email protected] data]# MKDIR/DATA/SMB2
[Email protected]/]# chown-r zxadmin.zxadmin/data/
770 /data/
5. Configuring smb.conf (vim/etc/samba/smb.conf)
[SMB1] = smb1 =/data/smb1 = Yes = zxadmin #指定zxadmin账户, This directory can only be accessed zxadmin = no = YES[SMB2] = smb2 =/data/ SMB2 = Yes = zxadmin,zx #指定zx和zxadmin账户, this directory is public directory = no = yes
6. Start the SMB Service
[[email protected] samba]#/etc/init.d/SMB startstarting SMB services: [ OK ]
7. Turn off the firewall and SELinux
8. Access Testing
CentOS Samba Build