作业四:
1) 新建目录/test/dir,属主为tom,数组为group1,/test目录的权限为777
# useradd tom
[root@localhost /]# groupadd group1
[root@localhost /]# chown tom.group1 /test/dir
drwxrwxrwx. 3tom grooup1 16 3月 15 18:28 test
2) 新建用户jack,切换到jack用户下,验证jack用户对dir目录的rwx权限(开启另外一个终端,依次修改dir目录的others权限)
[root@localhost ~]# su - jack
cd /test /dir
[jack@localhost test]$ ll
总用量 0
drwxr-xr-x. 2 tom group1 6 3月 15 18:26 dir
chmod o=r dir
[root@localhost test]# ll
总用量 0
drwxr-xr--. 2 tom group1 6 3月 15 18:26 dir
3)将jack加入group1组,验证jack用户对dir目录的rwx权限(开启另外一个终端,依次修改dir目录的group权限)
[root@localhost test]# usermod -G group1 jack
[root@localhost test]# ll
总用量 0
drwxr-xr--. 2 tom group1 6 3月 15 18:26 dir
4)切换到tom用户,验证tom用户对dir目录的rwx权限(开启另外一个终端,依次修改dir目录的user权限)
[tom@localhost test]$ ll
总用量 0
drwxr-xr--. 2 tom group1 6 3月 15 18:26 dir
5)在dir目录内新建文件tom.txt,属主为tom,属组为group1,/test目录的权限为777
[root@localhost dir]# touch tom.txt
[root@localhost dir]# useradd tom2
[root@localhost dir]# groupadd group2
6)新建用户rose,切换到rose用户下,验证rose用户对tom.txt的rwx权限(开启另外一个终端,依次修改tom.txt的others权限来配合验证过程)
[root@localhost dir]# touch rose.txt
[root@localhost dir]# useradd rose
[root@localhost dir]# groupadd rose
7)将rose加入group1组,在rose用户下,验证rose用户对tom.txt的rwx权限(开启另外一个终端,依次修改tom.txt的group1权限来配合验证过程)
[root@localhost test]# usermod -G group1 rose
[root@localhost test]# ll
总用量 0
drwxr-xr--. 2 rose group1 6 3月 15 18:26 dir
8)切换到tom用户,验证tom用户对tom.txt的rwx权限(开启另外一个终端,依次修改tom.txt的user权限来配合验证过程)
[tom@localhost test]$ ll
总用量 0
drwxr-xr--. 2 tom group1 6 3月 15 18:26 dir