Samba 建立服务器基于用户验证方式的共享目录

Samba 建立服务器基于用户验证方式的共享目录(注意:服务器采用用户验证)

任务说明:
1、服务器采用用户验证的方式

2、建立一个group1的文件夹,并且只有用户group1才有权访问并读写。

3、建立一个gp1的目录,只有group1组的用户可以访问并读写

4、建立一个gp2的目录,group1组和group2组的用户都可以读,但只有group2组的用户有权写

5、建立一个公共的只读文件夹public,所有人只读这个文件夹的内容;

1.添加组,并为组添加用户

#groupadd group1

#groupadd group2

#useradd -g group1 group1

#useradd -g group1 user1

#useradd -g group1 user2

#useradd -g group2 group2

#useradd -g group2 user3

#useradd -g group2 user4

#smbpasswd -a group1

#smbpasswd -a group2

#smbpasswd -a user1

#smbpasswd -a user2

#smbpasswd -a user3

#smbpasswd -a user4

2.修改配置文件:smb.conf

debian:~# vi /etc/samba/smb.conf

[global]

security = user

encrypt passwords = yes

smb passwd file = /etc/samba/smbpasswd

[homes]

comment = home directories

browseable = no

writeable = yes

valid users = %S

create mode = 0664

directory mode = 0775

[public]

comment = public's directory

path = /home/public

public = yes

writeable = no

[group1]

path = /home/group1

comment = group1's diterctory

public = no

writeable = yes

valid users = group1

[gp1]

path = /home/gp1

comment = gp1's diterctory

public = no

valid users = @group1

write list = @group1

[gp2]

path = /home/gp2

comment = gp2's diterctory

public = no

valid users = @group1,@group2

write list = group2

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/ppxdf.html