#1、创建g1组,要求创建一个属于redhat用户g1组的文件redhat.txt
#2、新建/sc目录,所属组为group组,root用户和group组用户可在该目录下创建文件,其他人无任何权限
#3、新建/cw目录为财务部存储目录,只能对财务部人员可以写入,并且财务部人员所建立的文件都自动属于mygroup组中
#4、设置helen用户对于/sc和/cw目录可读、可写、可执行
#5、设置/test目录为公共存储目录,对所有用户可以读、写、执行,但用户只能删除属于自己的文件。
#6、在/test/dir里创建的新文件自动属于temp组
#1
[root@bai ~]# groupadd g1
[root@bai ~]# useradd redhat
[root@bai ~]# touch /redhat.txt
[root@bai ~]# ll -d /redhat.txt
[root@bai ~]# chown redhat:g1 /redhat.txt
[root@bai ~]# ll -d /redhat.txt
-rw-r--r--. 1 redhat g1 0 4月 24 22:21 /redhat.txt
#2
[root@bai ~]# mkdir /sc
[root@bai ~]# groupadd group
[root@bai ~]# setfacl -m g:group:rwx /sc
[root@bai ~]# getfacl /sc
getfacl: Removing leading '/' from absolute path names
# file: sc
# owner: root
# group: root
user::rwx
group::r-x
group:group:rwx
mask::rwx
other::r-x
[root@bai ~]# chmod o=--- /sc
[root@bai ~]# ll -d /sc
drwxrwx---+ 2 root root 6 4月 24 22:24 /sc
#3 令财务部人员用户为mygroup
[root@bai ~]# mkdir /cw
[root@bai ~]# groupadd mygroup
[root@bai ~]# useradd mygroup -g mygroup
[root@bai ~]# ll -d /cw
drwxr-xr-x. 2 root root 6 4月 24 22:30 /cw
[root@bai ~]# chown mygroup:mygroup /cw
[root@bai ~]# chmod g+s /cw
[root@bai ~]# ll -d /cw
drwxr-sr-x. 2 mygroup mygroup 6 4月 24 22:30 /cw
#4
[root@bai ~]# setfacl -m u:helen:rwx /sc /cw
[root@bai ~]# getfacl /sc /cw
getfacl: Removing leading '/' from absolute path names
# file: sc
# owner: root
# group: root
user::rwx
user:helen:rwx
group::r-x
group:group:rwx
mask::rwx
other::---
#5
[root@bai ~]# mkdir /test
[root@bai ~]# chmod 777 /test
[root@bai ~]# chmod o+t /test
[root@bai ~]# ll -d /test
drwxrwxrwt. 2 root root 6 4月 24 22:37 /test
#6
[root@bai ~]# mkdir /test/dir
[root@bai ~]# groupadd temp
[root@bai ~]# chown :temp /test/dir
[root@bai ~]# chmod g+s /test/dir
[root@bai ~]# ll -d /test/dir
drwxr-sr-x. 2 root temp 6 4月 24 22:38 /test/dir
# file: cw
# owner: mygroup
# group: mygroup
# flags: -s-
user::rwx
user:helen:rwx
group::r-x
mask::rwx
other::r-x