一.实验要求
二.实验步骤
1.当用户redhat对/testdir目录无写权限时,该目录下的只读文件file1是否可修改和删除(无法进行修改和删除)
[root@cheng testdir]# su redhat
[redhat@cheng testdir]$ ll -a
总用量 8
[redhat@cheng testdir]$ echo aaaaaaaaa >> file1
bash: file1: 权限不够
[redhat@cheng testdir]$ rm -f file1
rm: 无法删除"file1"权限不够
结果:[root@localhot /]#ll
total 28
drwxr-xr-x. 2 root root 19 oct 5 21:09 testdir
drwxrwxrwx. 23 root root 4096 oct 5 21:05 tmp
~
~
~
~
~
E45:'readonly' option is set (add! to override)
2.复制/etc/fstab文件到/var/tmp下,设置文件所有者为redhat,有读写权限,所属组为cxk组,有读写权限,其他人无权限
[root@cheng tmp]# cp /etc/fstab /var/tmp/
[root@cheng tmp]# ls
file1.swp
fstab
[root@cheng tmp]# chown redhat.cxk fstab
[root@cheng tmp]# ll
结果:-rw-------.1 redhat 12288 Oct 5 21:15 file1.swp
-rw-r--r--.1 redhat cxk 579 oct 5 21:19 fstab
[root@cheng tmp]# chmod ug=rw fstab
[root@cheng tmp]# chmod o=--- fstab
[root@cheng tmp]# ll
结果:
-rw-------.1 redhat 12288 Oct 5 21:15 file1.swp
-rw-r--r--.1 redhat cxk 579 oct 5 21:19 fstab
3.要求在/tmp/testdir里创建的新文件自动属于g1组,组g2的成员如alice能对这些新文件有读写权限,组g3的成员如tom只能对新文件有读权限,其他用户 (不属于g1,g2,g3) 不能访问这个文件夹
setfacl -m g:g1:rwx -m g:g2:rwx -m g:g3:r-- -m o::- .
4.让普通用户有能力使用cat文件阅读/etc/shadow文件
[root@cheng etc]# chmod u=rws shadow
[root@cheng etc]$ sudo cat /etc/shadow
5.创建/tmp/aaaa/目录,该目录中的文件只能文件拥有者可以删除
[root@cheng etc]# mkdir /tmp/aaaa/
[root@cheng etc]# cd /tmp
[root@cheng etc]# ll
结果:drwxr-xr-x. 2 root root 6 oct 5 21:32 aaaa