Samba实验

建立samba共享,共享目录为/test,要求:

1、共享名为shared,工作组为magedu

2、添加组develop,添加用户gentoo,centos和ubuntu,其中gentoo和centos以develop为附加组,Ubuntu不属于develop组,密码均为用户名

3、添加samba用户,gentoo,centos和ubuntu密码均为“magedu”

4、此samba共享shared仅允许develop组具有写权限,其他用户只能以只读方式访问

5、此samba共享服务仅允许来自于172.16.0.0/16网络的主机访问

[root@localhost ~]# yum install samba

[root@localhost ~]# mkdir /test

[root@localhost ~]# groupadd develop

[root@localhost ~]# groupadd develop

[root@localhost ~]# useradd -G develop gentoo

[root@localhost ~]# useradd -G develop centos

[root@localhost ~]# useradd ubuntu

[root@localhost ~]# smbpasswd -a gentoo

New SMB password:

Retype new SMB password:

Added user gentoo.

[root@localhost ~]# smbpasswd -a centos

New SMB password:

Retype new SMB password:

Added user centos.

[root@localhost ~]# smbpasswd -a ubuntu

New SMB password:

Retype new SMB password:

Added user ubuntu.

修改/etc/samba/smb.conf,[global]中修改工作组

workgroup = magedu

[sharedddddd]

comment = shared test

path = /test

browseable = yes

writeable = yes

write list = +develop

allow hosts = 172.20.0.0/16

[root@localhost ~]# testparm

Load smb config files from /etc/samba/smb.conf

rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)

Processing section "[sharedddddd]"

Loaded services file OK.

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

[global]

workgroup = MAGEDU

client signing = required

idmap config * : backend = tdb

[sharedddddd]

comment = shared test

path = /test

write list = +develop

read only = No

hosts allow = 172.20.0.0/16

[root@localhost ~]# ll -d /test

drwxr-xr-x 2 root root 4096 Aug 13 14:49 /test

[root@localhost ~]# chown :develop /test/

[root@localhost ~]# chmod g+w /test/

[root@localhost ~]# ll -d /test/

drwxrwxr-x 2 root develop 4096 Aug 13 14:49 /test/

验证,使用gentoo和centos登录可以创建文件,使用Ubuntu不能创建

Samba搭建实现简单功能_shared

Samba搭建实现简单功能_工作组_02

Samba搭建实现简单功能_ubuntu_03

Samba搭建实现简单功能_工作组_04