RHCSA用户管理作业

一.实验要求

二.实验步骤

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

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值