作业 六个题

Xshell 7 (Build 0144)
Copyright (c) 2020 NetSarang Computer, Inc. All rights reserved.

Type `help' to learn how to use Xshell prompt.
[C:\~]$ ssh 192.168.65.130


Connecting to 192.168.65.130:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Activate the web console with: systemctl enable --now cockpit.socket

Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Tue May  7 20:20:48 2024
[root@localhost ~]# groupadd g1
[root@localhost ~]# touch /wzh2.txt
[root@localhost ~]# ll /wzh2.txt
-rw-r--r--. 1 root root 0  5月  7 20:31 /wzh2.txt
[root@localhost ~]# chown wzh2:g1 /wzh2.txt
[root@localhost ~]# mkdir /sc
[root@localhost ~]# ll /d /sc
ls: 无法访问 '/d': 没有那个文件或目录
/sc:
总用量 0
[root@localhost ~]# ll -d /sc
drwxr-xr-x. 2 root root 6  5月  7 20:32 /sc
[root@localhost ~]# groupadd group\
> ^C
[root@localhost ~]# groupadd group
[root@localhost ~]# chown :group /sc
[root@localhost ~]# ll -d /sc
drwxr-xr-x. 2 root group 6  5月  7 20:32 /sc
[root@localhost ~]# chmod g+w /sc
[root@localhost ~]# ll -d /sc
drwxrwxr-x. 2 root group 6  5月  7 20:32 /sc
[root@localhost ~]# chmod 770 /sc
[root@localhost ~]# ll -d /sc
drwxrwx---. 2 root group 6  5月  7 20:32 /sc
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# mkdir /cw
[root@localhost ~]# ll /cw
总用量 0
[root@localhost ~]# ll /cw -d
drwxr-xr-x. 2 root root 6  5月  7 20:41 /cw
[root@localhost ~]# groupadd mygroup
[root@localhost ~]# chown :mygroup /cw
[root@localhost ~]# ll /cw -d
drwxr-xr-x. 2 root mygroup 6  5月  7 20:41 /cw
[root@localhost ~]# gpasswd -M zhang3,li4 mygroup
gpasswd:用户“zhang3”不存在
gpasswd:用户“li4”不存在
[root@localhost ~]# groupadd zhang3
[root@localhost ~]# groupadd li4
[root@localhost ~]# gpasswd -M zhang3,li4 mygroup
gpasswd:用户“zhang3”不存在
gpasswd:用户“li4”不存在
[root@localhost ~]# userdel zhang3 -r
userdel:用户“zhang3”不存在
[root@localhost ~]# groupadd zhang3
groupadd:“zhang3”组已存在
[root@localhost ~]# useradd zhang3 -u 1080 -g zhang3 -ccallme110 -d /zhang3 -s/bin/sh
[root@localhost ~]# grep zhang3 /etc/passwd /etc/shadow /etc/group
/etc/passwd:zhang3:x:1080:1004:callme110:/zhang3:/bin/sh
/etc/shadow:zhang3:!!:19850:0:99999:7:::
/etc/group:zhang3:x:1004:
[root@localhost ~]# groupadd li4
groupadd:“li4”组已存在
[root@localhost ~]# useradd li4 -u 1080 -g li4 -ccallme110 -d /li4 -s/bin/sh
useradd:UID 1080 并不唯一
[root@localhost ~]# userdel zhang3 -r
[root@localhost ~]# userdel li4 -r
userdel:用户“li4”不存在
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# vim /etc/shadow
[root@localhost ~]# useradd zhang3
[root@localhost ~]# useradd li4
useradd:li4 组已经存在 - 如果您想将此用户加入到该组,请使用 -g 参数。
[root@localhost ~]# vim /etc/group
[root@localhost ~]# groupdel li4
[root@localhost ~]# useradd li4
[root@localhost ~]# vim /etc/shadow
[root@localhost ~]# gpasswd -M zhang3,li
gpasswd:用户“li”不存在
[root@localhost ~]# gpasswd -M zhang3,li4 mygroup
[root@localhost ~]# ll -cw -d
ls: 无效的行宽: “-d”
[root@localhost ~]# ll /cw -d
drwxr-xr-x. 2 root mygroup 6  5月  7 20:41 /cw
[root@localhost ~]# chomd g+s /cw
bash: chomd: command not found...
Similar command is: 'chmod'
[root@localhost ~]# chmod g+s /cw
[root@localhost ~]# su -zhang3
su: 不适用的选项 -- z
请尝试执行“su --help”了解更多信息。
[root@localhost ~]# su -zhang3
su: 不适用的选项 -- z
请尝试执行“su --help”了解更多信息。
[root@localhost ~]# su --help

用法:
 su [选项] [-] [<用户> [<参数>...]]

Change the effective user ID and group ID to that of <user>.
A mere - implies -l.  If <user> is not given, root is assumed.

选项:
 -m, -p, --preserve-environment      不重置环境变量
 -w, --whitelist-environment <list>  don't reset specified variables

 -g, --group <组>                指定主组
 -G, --supp-group <group>        specify a supplemental group

 -, -l, --login                  使 shell 成为登录 shell
 -c, --command <命令>            使用 -c 向 shell 传递一条命令
 --session-command <命令>        使用 -c 向 shell 传递一条命令
                                   而不创建新会话
 -f, --fast                      向shell 传递 -f 选项(csh 或 tcsh)
 -s, --shell <shell>             若 /etc/shells 允许,运行<shell>
 -P, --pty                       create a new pseudo-terminal

 -h, --help                      显示此帮助
 -V, --version                   显示版本

更多信息请参阅 su(1)。
[root@localhost ~]# su - zhang3
[zhang3@localhost ~]$ touch /cw/file1
touch: 无法创建 '/cw/file1': 权限不够
[zhang3@localhost ~]$ exit
注销
[root@localhost ~]# chmod g+w /cw
[root@localhost ~]# su - zhang3
[zhang3@localhost ~]$ touch /cw/file1
[zhang3@localhost ~]$ exit
注销
[root@localhost ~]# su - li4
[li4@localhost ~]$ touch /cw/file2
[li4@localhost ~]$ exit
注销
[root@localhost ~]# ll /cw
总用量 0
-rw-r--r--. 1 zhang3 mygroup 0  5月  7 22:06 file1
-rw-r--r--. 1 li4    mygroup 0  5月  7 22:07 file2
[root@localhost ~]# ll -d
dr-xr-x---. 17 root root 4096  5月  7 20:56 .
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# ll -d /cw
drwxrwsr-x. 2 root mygroup 32  5月  7 22:07 /cw
[root@localhost ~]# setfac1 -m u:helen:rwx /sc
bash: setfac1: command not found...
[root@localhost ~]# setfac1 -m u:helen:rwx /sc
bash: setfac1: command not found...
[root@localhost ~]# setfac1 -m u : hele n: rwx /sc
bash: setfac1: command not found...
[root@localhost ~]# setfac1 -m u :helen :rwx /sc
bash: setfac1: command not found...
[root@localhost ~]# getfafcl
bash: getfafcl: command not found...
[root@localhost ~]# useradd helen
useradd:用户“helen”已存在
[root@localhost ~]# setfac1 -m u :helen :rwx /sc
bash: setfac1: command not found...
[root@localhost ~]# setfac1 -m u:helen:rwx /sc
bash: setfac1: command not found...
[root@localhost ~]# setfac1 -m u:helen:rwx /sc
bash: setfac1: command not found...
[root@localhost ~]# setfacl -m u:helen:rwx /sc
[root@localhost ~]# setfacl -m u:helen:rwx /cw
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# mkdir /test
[root@localhost ~]# chmod 777 /test/
[root@localhost ~]# ll -d /test/
drwxrwxrwx. 2 root root 6  5月  7 22:45 /test/
[root@localhost ~]# chmod o+t /test/
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# mkdir /test/dir
[root@localhost ~]# chmod g+s /test/dir
[root@localhost ~]# ll -d /test/dir
drwxr-sr-x. 2 root root 6  5月  7 22:52 /test/dir
[root@localhost ~]# chmod o+w /test/dir/
[root@localhost ~]# groupadd temp
[root@localhost ~]# chown :temp /test/dir/
[root@localhost ~]# ll -d /test/dir/
drwxr-srwx. 2 root temp 15  5月  7 22:53 /test/dir/
[root@localhost ~]# ll /test/dir/
总用量 0
-rw-r--r--. 1 xujing root 0  5月  7 22:53 1
-rw-r--r--. 1 wzh2   temp 0  5月  7 22:55 3
 

Xshell 7 (Build 0144)
Copyright (c) 2020 NetSarang Computer, Inc. All rights reserved.

Type `help' to learn how to use Xshell prompt.
[C:\~]$ ssh 192.168.65.130


Connecting to 192.168.65.130:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Activate the web console with: systemctl enable --now cockpit.socket

Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Tue May  7 20:21:52 2024 from 192.168.65.1
[root@localhost ~]# useradd helen
[root@localhost ~]# chown rehat:g1 /redhat.txt
chown: 无效的用户: “rehat:g1”
[root@localhost ~]# useradd helen
useradd:用户“helen”已存在
[root@localhost ~]# su - helen
[helen@localhost ~]$ ls -l /sc
总用量 0
[helen@localhost ~]$ ls -l /cw
总用量 0
-rw-r--r--. 1 zhang3 mygroup 0  5月  7 22:06 file1
-rw-r--r--. 1 li4    mygroup 0  5月  7 22:07 file2
[helen@localhost ~]$ touch /sc/file1
[helen@localhost ~]$ touch /cw/file2
touch: 无法创建 '/cw/file2': 权限不够
[helen@localhost ~]$ touch /cw/file12
[helen@localhost ~]$ cd /cw
[helen@localhost cw]$ 
[helen@localhost cw]$ 
[helen@localhost cw]$ 
[helen@localhost cw]$ 
[helen@localhost cw]$ 
[helen@localhost cw]$ 
[helen@localhost cw]$ 
[helen@localhost cw]$ touch /test/1
[helen@localhost cw]$ exit
注销
[root@localhost ~]# su - wzh2
[wzh2@localhost ~]$ touch /test/2
[wzh2@localhost ~]$ exit
注销
[root@localhost ~]# su - xujing
su: user xujing does not exist or the user entry does not contain all the required fields
[root@localhost ~]# su - xujing
su: user xujing does not exist or the user entry does not contain all the required fields
[root@localhost ~]# su - xujing
su: user xujing does not exist or the user entry does not contain all the required fields
[root@localhost ~]# useradd xujing
[root@localhost ~]# su - xujing
[xujing@localhost ~]$ touch /test/3
 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值