题目
police(警察) , bandit(土匪)
jack, jerry: 警察
xh, xq: 土匪
1.创建组
2.创建用户
3.jack 创建一个文件,自己可以读 r 写 w,本组人可以读,其它组没人任何权限
4.jack 修改该文件,让其它组人可以读, 本组人可以读写
5.xh 投靠 警察,看看是否可以读写.
——————————————————————————————
**
代码
**
**(1,2)创建用户和组
**
Xshell 5 (Build 1044)
Copyright (c) 2002-2016 NetSarang Computer, Inc. All rights reserved.
Type `help' to learn how to use Xshell prompt.
[D:\NetSarang\Xshell\Sessions]$
Connecting to 192.168.80.128:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Mon Jun 6 10:03:54 2022
[root@192 ~]# ll /home/
总用量 144
drwx------. 2 aaa aaa 62 3月 14 08:49 aaa
drwx------. 2 father1 family1 101 5月 23 08:22 father1
drwx------. 2 aaa aaa 83 5月 16 13:20 gg
-rwxr-xr-x. 1 root bin 142928 5月 23 14:37 install.log
lrwxrwxrwx. 1 root root 5 5月 2 08:31 linkToBoot -> /root
drwx------. 2 pear pear 4096 5月 16 13:22 pear
[root@192 ~]# groupadd police
[root@192 ~]# groupadd bandit
[root@192 ~]# ll
总用量 292
-rw-------. 1 root root 1203 2月 26 19:47 anaconda-ks.cfg
-rw-r--r--. 1 root root 136373 6月 6 09:31 fruits.tar.gz
-rw-r--r--. 1 root root 0 4月 11 09:34 ilovechina.list
-rwxr-xr-x. 1 bin bin 142928 5月 23 15:15 install.log
lrwxrwxrwx. 1 root root 5 5月 2 08:20 linkToBoot -> /home
-rw-r--r--. 1 root root 0 5月 16 13:26 linux10.txt
-rw-r--r--. 1 root root 0 5月 16 13:26 linux1.txt
-rw-r--r--. 1 root root 0 5月 16 13:26 linux2.txt
-rw-r--r--. 1 root root 0 5月 16 13:26 linux3.txt
-rw-r--r--. 1 root root 0 5月 16 13:26 linux4.txt
-rw-r--r--. 1 root root 0 5月 16 13:26 linux5.txt
-rw-r--r--. 1 root root 0 5月 16 13:26 linux6.txt
-rw-r--r--. 1 root root 0 5月 16 13:26 linux7.txt
-rw-r--r--. 1 root root 0 5月 16 13:26 linux8.txt
-rw-r--r--. 1 root root 0 5月 16 13:26 linux9.txt
-rw-r--r--. 1 root root 135 4月 18 08:52 mydate.txt
-rw-r--r--. 1 root root 1600 5月 2 08:48 myfile.hard
-rw-r--r--. 1 root root 0 5月 23 08:23 myfile.txt
-rw-r--r--. 1 root root 0 5月 2 13:44 newfile-hlink.txt
-rw-r--r--. 1 root root 13 5月 16 12:43 test.txt
drwxr-xr--. 3 root root 20 6月 6 09:37 tmp
-rw-r--r--. 1 root root 0 5月 23 14:43 ycy.txt
[root@192 ~]# ll /home/
总用量 144
drwx------. 2 aaa aaa 62 3月 14 08:49 aaa
drwx------. 2 father1 family1 101 5月 23 08:22 father1
drwx------. 2 aaa aaa 83 5月 16 13:20 gg
-rwxr-xr-x. 1 root bin 142928 5月 23 14:37 install.log
lrwxrwxrwx. 1 root root 5 5月 2 08:31 linkToBoot -> /root
drwx------. 2 pear pear 4096 5月 16 13:22 pear
[root@192 ~]# ll /home/
总用量 144
drwx------. 2 aaa aaa 62 3月 14 08:49 aaa
drwx------. 2 father1 family1 101 5月 23 08:22 father1
drwx------. 2 aaa aaa 83 5月 16 13:20 gg
-rwxr-xr-x. 1 root bin 142928 5月 23 14:37 install.log
lrwxrwxrwx. 1 root root 5 5月 2 08:31 linkToBoot -> /root
drwx------. 2 pear pear 4096 5月 16 13:22 pear
[root@192 ~]# groupadd police
groupadd:“police”组已存在
[root@192 ~]# groupdel police
[root@192 ~]# groupdel bandit
[root@192 ~]#
[root@192 ~]#
[root@192 ~]#
[root@192 ~]# clear
[root@192 ~]# ll /home/
总用量 144
drwx------. 2 aaa aaa 62 3月 14 08:49 aaa
drwx------. 2 father1 family1 101 5月 23 08:22 father1
drwx------. 2 aaa aaa 83 5月 16 13:20 gg
-rwxr-xr-x. 1 root bin 142928 5月 23 14:37 install.log
lrwxrwxrwx. 1 root root 5 5月 2 08:31 linkToBoot -> /root
drwx------. 2 pear pear 4096 5月 16 13:22 pear
[root@192 ~]# groupadd police
[root@192 ~]# groupadd bandit
[root@192 ~]# ll /home/
总用量 144
drwx------. 2 aaa aaa 62 3月 14 08:49 aaa
drwx------. 2 father1 family1 101 5月 23 08:22 father1
drwx------. 2 aaa aaa 83 5月 16 13:20 gg
-rwxr-xr-x. 1 root bin 142928 5月 23 14:37 install.log
lrwxrwxrwx. 1 root root 5 5月 2 08:31 linkToBoot -> /root
drwx------. 2 pear pear 4096 5月 16 13:22 pear
[root@192 ~]# useradd -g police jack
[root@192 ~]# useradd -g police jerry
[root@192 ~]# useradd -g bandit xh
[root@192 ~]# useradd -g bandit xq
[root@192 ~]# ll /home/
总用量 144
drwx------. 2 aaa aaa 62 3月 14 08:49 aaa
drwx------. 2 father1 family1 101 5月 23 08:22 father1
drwx------. 2 aaa aaa 83 5月 16 13:20 gg
-rwxr-xr-x. 1 root bin 142928 5月 23 14:37 install.log
drwx------. 2 jack police 62 6月 6 10:11 jack
drwx------. 2 jerry police 62 6月 6 10:11 jerry
lrwxrwxrwx. 1 root root 5 5月 2 08:31 linkToBoot -> /root
drwx------. 2 pear pear 4096 5月 16 13:22 pear
drwx------. 2 xh bandit 62 6月 6 10:11 xh
drwx------. 2 xq bandit 62 6月 6 10:16 xq
[root@192 ~]#
给给用户赋予密码
[root@192 ~]# passwd jack
更改用户 jack 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
[root@192 ~]#
(3)登录jack创建文件
其中:
r=4 w=2 x=1
u:所有者
g:所有组
o:其他人
a:所有人(u、g、o 的总和)
(4)修改该文件,让其它组人可以读, 本组人可以读写
(5)xh 投靠 警察,看看是否可以读写.
切换到root给xh修改组
可以看到小红目前还没有查看文件的权限
使用Jack给他的家目录 /home/jack的所在组一个rx的权限
现在已经可以看到文件了