RHCSA 用户,组以及权限

1. 创建group2组

    [root@yuanziyi ~]# groupadd group2

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

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

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

    [root@yuanziyi ~]# echo 123 | passwd --stdin xiaoxiao

    Changing password for user xiaoxiao.

    passwd: all authentication tokens updated successfully.

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

    [root@yuanziyi ~]# userdel -r xiaoxiao

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

   [root@yuanziyi ~]# echo 123 > /tmp/1.txt

   [root@yuanziyi ~]# cat /tmp/1.txt

   123

   [root@yuanziyi ~]# chmod o+rw /tmp/1.txt

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

[root@yuanziyi ~]# echo this is root > /tmp/root.txt

[root@yuanziyi ~]# chmod o= /tmp/root.txt

[root@yuanziyi ~]# chmod o+r /tmp/root.txt

[root@yuanziyi ~]# useradd xiaoming

[root@yuanziyi ~]# echo xm | passwd --stdin xiaoming

Changing password for user xiaoming.

passwd: all authentication tokens updated successfully.

[root@yuanziyi ~]#useradd xiaohong

[root@yuanziyi ~]# echo xh | passwd --stdin xiaohong

Changing password for user xiaohong.

passwd: all authentication tokens updated successfully.

[root@yuanziyi ~]# setfacl -m u:xiaohong:rw /tmp/root.txt

[root@yuanziyi ~]# setfacl -m u:xiaoming:r /tmp/root.txt

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

[root@yuanziyi ~]# chown xiaohong:xiaohong /tmp/xiaoming.txt

[root@yuanziyi ~]# ll /tmp/xiaoming.txt

-rw-r--r--. 1 xiaohong xiaohong 0 Jul 19 07:50 /tmp/xiaoming.txt

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值