#1、创建g1组,要求创建一个属于redhat用户g1组的文件redhat.txt
groupadd g1 创建g1组
touch /redhat.txt 创建redhat.txt文件
chown redhat:g1 /redhat.txt 更改redhat.txt文件的组为g1组
#2、新建/sc目录,所属组为group组,root用户和group组用户可在该目录下创建文件,其他人无任何权限
mkdir /sc 创建sc目录
groupadd group 创建group组
chgrp group /sc 更改sc的组为group组
setfacl -m g:group:rwx /sc 设置facl权限,使属于group组的用户可在该目录下创建文件
#3、新建/cw目录为财务部存储目录,只能对财务部人员可以写入,并且财务部人员所建立的文件都自动属于mygroup组中
mkdir /cw 创建cw组
groupadd mygroup 创建mygroup组
setfacl -m g:mygroup:rwx /cw 使mygroup组的成员在/cw获得rwx权限
chgrp mygroup /cw 更改/cw目录的组为mygroup
chmod g+s /cw 为/cw目录设置guid权限,使mygroup组的成员可以进行读写执行
#4、设置helen用户对于/sc和/cw目录可读、可写、可执行
.useradd helen 创建用户
setfacl -m u:helen:rwx /sc /cw 设置facl
#5、设置/test目录为公共存储目录,对所有用户可以读、写、执行,但用户只能删除属于自己的文件。
mkdir /test 创建目录
chmod o+w /test 给其它用户加上写的权限
chmod g+w /test 给组加上写的权限
chmod o+t /test 给其它用户加以限制,使其只能删除自己创建的文件
#6、在/test/dir里创建的新文件自动属于temp组
mkdir /test/dir 创建目录
groupadd temp 创建组
chgrp temp /test/dir 更改/test/dir目录的组为temp
chmod g+s /test/dir 设置guid
chmod g+w /test/dir 给组加写的权限
chmod o+w /test/dir 给其他用户加写的权限