1.[root@localhost ~]# groupadd g1
[root@localhost ~]# useradd redhat
[root@localhost ~]# touch /redhat.txt
[root@localhost ~]# chown redhat:g1 /redhat.txt
[root@localhost ~]# ll -d /redhat.txt
-rw-r--r--. 1 redhat g1 0 4月 26 20:19 /redhat.txt
2.[root@localhost ~]# mkdir /sc
[root@localhost ~]# groupadd group
[root@localhost ~]# chown :group /sc
[root@localhost ~]# chmod 070 /sc
[root@localhost ~]# groupmod -M redhat group
[root@localhost ~]# gpasswd -M redhat group
[root@localhost ~]# useradd helen
[root@localhost ~]# su - redhat
[redhat@localhost ~]$ touch /sc/1
[redhat@localhost ~]$ su - helen
[helen@localhost ~]$ touch /sc/2
touch: 无法创建 '/sc/2': 权限不够
3.[root@localhost ~]# mkdir /cw
[root@localhost ~]# groupadd mygroup
[root@localhost ~]# chown :mygroup /cw
[root@localhost ~]# chmod g+s /cw
[root@localhost ~]# chmod 070 /cw
[root@localhost ~]# gpasswd -M redhat mygroup
[root@localhost ~]# su - redhat
[redhat@localhost ~]$ touch /cw/1
[redhat@localhost ~]$ exit
注销
[root@localhost ~]# su - helen
[helen@localhost ~]$ touch /cw/2
touch: 无法创建 '/cw/2': 权限不够
[helen@localhost ~]$ exit
注销
[root@localhost ~]# ll -d /cw
d---rws---. 2 root mygroup 15 4月 26 20:33 /cw
[root@localhost ~]# ll -d /cw/
d---rws---. 2 root mygroup 15 4月 26 20:33 /cw/
[root@localhost ~]# ll -d /cw/1
-rw-r--r--. 1 redhat mygroup 0 4月 26 20:33 /cw/1
[root@localhost ~]#
4.[root@localhost ~]# setfacl -m u:helen:rwx /cw /sc
[root@localhost ~]# su - helen
[helen@localhost ~]$ touch /cw/2
[helen@localhost ~]$ touch /sc/2
5.[root@localhost ~]# mkdir /test
[root@localhost ~]# chmod 777 /test
[root@localhost ~]# chmod o+t /test
[root@localhost ~]# touch /test/1
[root@localhost ~]# su - redhat
[redhat@localhost ~]$ touch /test/2
[redhat@localhost ~]$ su - helen
[root@localhost ~]# su - helen
[helen@localhost ~]$ touch /test/3
[helen@localhost ~]$ rm -rf /test
rm: 无法删除 '/test/1': 不允许的操作
rm: 无法删除 '/test/2': 不允许的操作
6.[root@localhost ~]# groupadd temp
[root@localhost ~]# mkdir /test/dir
[root@localhost ~]# chown :temp /test/dir/
[root@localhost ~]# chmod g+s /test/dir
[root@localhost ~]# touch /test/dir/1
[root@localhost ~]# ll -d /test/dir/1
-rw-r--r--. 1 root temp 0 4月 26 20:42 /test/dir/1