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