RHCSA实验

实验要求:

1、新建几个普通用户wukong,wuneng,wujing,他们都属于xiyouji组的成员,其中wujing没有和系统交互的shell。
2、wukong和wuneng的密码都为redhat。
3、通过sudo使得wukong可以使用wuneng和wujing的权限在他们的家目录下创建普通文件file。
4、通过sudo使得wukong可以将密码配置文件中自己的密码信息相关内容保存至自己家目录下的mima文件。
5、创建用户和组,新建一个名为adminuser的组,组id为3333;新建一个名为xiaoming的用户,将adminuser作为其附属组,且其uid为2003;新建一个名为xiaohong的用户,将adminuser作为其附属组;新建一个名为xiaohei的用户,其不属于adminuser组,其在系统中没有任何可交互的shell;三个用户的密码都是redhat。

实验内容

1.

[redhat@localhost ~]$ su -
Password: 
[root@localhost ~]# groupadd xiyouji
[root@localhost ~]# useradd -g xiyouji wukong
[root@localhost ~]# useradd -g xiyouji wuneng
[root@localhost ~]# useradd -g xiyouji -s /sbin/nologin wujing
[root@localhost ~]# 

如图 : 

2.

[root@localhost ~]# passwd wuneng
Changing password for user wuneng.
New password: 
BAD PASSWORD: The password fails the dictionary check - it is too simplistic/systematic
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@localhost ~]# passwd wukong
Changing password for user wukong.
New password: 
BAD PASSWORD: The password fails the dictionary check - it is too simplistic/systematic
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@localhost ~]# 

如图:

 

密码简单,需要输入两次才可成功。

3.



[root@localhost ~]# vim /etc/sudoers

按“a”键进入编辑模式,
在## Allow root to run any commands anywhere,后输入
wukong   ALL=(ALL)  ALL
wuneng   ALL=(ALL)  ALL

然后在 ##Allows people in group wheel to run all commands,下输入
xiyouji   ALL=(ALL)   ALL

可使用/方法查找如图:

如图:

[root@localhost ~]# su - wukong
[wukong@localhost ~]$ sudo -u wuneng touch /home/wuneng/file
[wukong@localhost ~]$ sudo -u wujing touch /home/wujing/file
[wukong@localhost ~]$ sudo -u wujing ls -l  /home/wujing/
total 0
-rw-r--r--. 1 wujing xiyouji 0 Jul 20 20:33 file
[wukong@localhost ~]$ sudo -u wujing ls -l /home/wujing
total 0
-rw-r--r--. 1 wujing xiyouji 0 Jul 20 20:33 file
[wukong@localhost ~]$ 

 如图:

4.

[root@localhost ~]# sudo -u wukong  grep wukong /etc/passwd > /home/wukong/mima
[root@localhost ~]# sudo -u wukong cat /home/wukong/mima
wukong:x:1001:1001::/home/wukong:/bin/bash
[root@localhost ~]# 

如图: 

 5.

[root@localhost ~]# groupadd adminuser
[root@localhost ~]# groupmod adminuser -g 3333
[root@localhost ~]# useradd xiaoming -u 2003 -G 3333
[root@localhost ~]# useradd xiaohong -G 3333
[root@localhost ~]# useradd xioahei
[root@localhost ~]# vim /etc/passwd
[root@localhost ~]

如图: 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值