RHCSA暑期第一次作业

1.创建group2组

​
[root@fangyining ~]# groupadd group2

​

2.创建xiaoxiao用户并指group2作为它的基本组

[root@fangyining ~]# useradd xiaoxiao -g group2

3.给xiaoxiao用户设置密码为123

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

4.删除xiaoxiao用户的同时删除与之相关的文件和目录

[root@fangyining ~]# userdel -r xiaoxiao

一,root用户在/tmp下创建一个1.txt的文件,写入123的内容并查看,修改1.txt文件的其他人的权限为读写。

[root@fangyining ~]# touch /tmp/1.txt
[root@fangyining ~]# echo 123 > /tmp/1.txt
[root@fangyining ~]# cat /tmp/1.txt
123
[root@fangyining ~]# chmod o+w /tmp/1.txt

二,root用户在/temp下创建root.txt文件,写入“这是root”内容。修改其他人的权限为 -。创建一个xiaohong和xiaoming两个用户,并设置密码xh和xm,让xiaohong可以对root.txt有读写的权限,让xiaoming可以对root.txt有读的权限。

[root@fangyining ~]# touch /tmp/root.txt
[root@fangyining ~]# echo 这是root > /tmp/root.txt
[root@fangyining ~]# chmod o=- /tmp/root.txt
[root@fangyining ~]# useradd xiaohong
[root@fangyining ~]# echo xh | passwd --stdin xiaohong
Changing password for user xiaohong.
passwd: all authentication tokens updated successfully.
[root@fangyining ~]# useradd xiaoming
[root@fangyining ~]# echo xm | passwd --stdin xiaoming
Changing password for user xiaoming.
passwd: all authentication tokens updated successfully.
[root@fangyining ~]# setfacl -m u:xiaohong:rw /tmp/root.txt
[root@fangyining ~]# setfacl -m u:xiaoming:r /tmp/root.txt

三,xiaoming用户在/tmp下创建一个xiaoming.txt的文件,修改xiaoming.txt的属者和属组为xiaohong。 

[xiaoming@fangyining ~]$ touch /tmp/xiaoming.txt
[root@fangyining ~]# chown xiaohong:xiaohong /tmp/xiaoming.txt

 

 

 

 

 

 

 

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值