RHCSA第五天作业

1、新建几个普通用户wukong,wuneng,wujing,他们都属于xiyouji组的成员,其中wujing没有和系统交互的shell。

[root@localhost ~]# groupadd  xiyouji
[root@localhost ~]# useradd -g xiyouji wukong
[root@localhost ~]# useradd -g xiyouji wuneng
[root@localhost ~]# useradd -g xiyouji wujing
[root@localhost ~]# vim /etc/passwd
wukong:x:1001:1001::/home/wukong:/bin/bash
wuneng:x:1002:1001::/home/wuneng:/bin/bash
wujing:x:1003:1001::/home/wujing:

2、wukong和wuneng的密码都为redhat。

[root@localhost ~]# passwd wukong
Changing password for user wukong.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# passwd wuneng
Changing password for user wuneng.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.

3、通过sudo使得wukong可以使用wuneng和wujing的权限在他们的家目录下创建普通文件file。

[wukong@localhost ~]$ sudo - wujing  touch /home/wujing/file
[sudo] password for wukong:
wukong is not in the sudoers file.  This incident will be reported.
[root@localhost ~]# vim  /etc/sudoers     编辑sudoers这个文件,将wukong添加进去
[wukong@localhost ~]$ sudo  -u  wuneng  touch /home/wuneng/file
[sudo] password for wukong:
[wukong@localhost ~]$ sudo  -u  wujing  touch /home/wujing/file
[wukong@localhost ~]$ exit
logout
[root@localhost ~]# ll /home/wuneng
total 0
-rw-r--r--. 1 wuneng xiyouji 0 May 17 18:12 file
[root@localhost ~]# ll /home/wujing
total 0
-rw-r--r--. 1 wujing xiyouji 0 May 17 18:13 file

4、通过sudo使得wukong可以将密码配置文件中自己的密码信息相关内容保存至自己家目录下的mima文件。

[wukong@localhost ~]$ sudo -u root grep    wukong   /etc/shadow  | tee  mima
wukong:$6$XOL/TRFjsyp2jzzu$O2s60CGH9SJlKvEZ0WCY5FuUem8vp6dr2rx0NVb9CscIn4gIdTwteBEHvtsqhnGlTtV.xK0WOF9HQEmu9a9k/1:18764:0:99999:7:::
[wukong@localhost ~]$ ll
total 4
-rw-r--r--. 1 wukong xiyouji 133 May 17 18:36 mima
[wukong@localhost ~]$ cat mima
wukong:$6$XOL/TRFjsyp2jzzu$O2s60CGH9SJlKvEZ0WCY5FuUem8vp6dr2rx0NVb9CscIn4gIdTwteBEHvtsqhnGlTtV.xK0WOF9HQEmu9a9k/1:18764:0:99999:7:::

5、创建用户和组,新建一个名为adminuser的组,组id为3333;新建一个名为xiaoming的用户,将adminuser作为其附属组,且其uid为2003;新建一个名为xiaohong的用户,将adminuser作为其附属组;新建一个名为xiaohei的用户,其不属于adminuser组,其在系统中没有任何可交互的shell;三个用户的密码都是redhat。

[root@localhost ~]# groupadd -g 3333 adminuser
[root@localhost ~]# useradd -G adminuser -u 2003 xiaoming
[root@localhost ~]# usdradd -G adminuser xiaohong
bash: usdradd: command not found...
[root@localhost ~]# useradd -G adminuser xiaohong
[root@localhost ~]# useradd xiaohei
[root@localhost ~]# vim  /etc/passwd
[root@localhost ~]# passwd xiaoming
Changing password for user xiaoming.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# passwd xiaohong
Changing password for user xiaohong.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# passwd xiaohei
Changing password for user xiaohei.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值