第二次csa作业

1、当用户redhat对/testdir目录无写权限时,该目录下的只读文件file1是否可修改和删除?

不能

2、复制/etc/fstab文件到/var/tmp下,设置文件所有者为redhat,有读写权限,所属组为cxk组,有读写权限,其他人无权限

[root@localhost ~]# cp /etc/fstab /var/tmp
[root@localhost ~]# groupadd cxk
[root@localhost ~]# chown redhat.cxk /var/tmp/fstab
[root@localhost ~]# chmod 660 /var/tmp/fstab
[root@localhost ~]# ll /var/tmp/fstab
 

3、要求在/tmp/testdir里创建的新文件自动属于g1组,组g2的成员如alice能对这些新文件有读写权限,组g3的成员如tom只能对新文件有读权限,其他用户(不属于g1,g2,g3)不能访问这个文件夹

[root@localhost ~]# groupadd g2
[root@localhost ~]# groupadd g3
[root@localhost ~]# useradd alice -g g2
[root@localhost ~]# useradd tom -g g3
[root@localhost ~]# mkdir -p /tmp/testdir
[root@localhost ~]# chown :g1 /tmp/testdir
[root@localhost ~]# chmod g+s /tmp/testdir
[root@localhost ~]# chmod o-rwx /tmp/testdir
[root@localhost ~]# setfacl -d -m g:g2:rw /tmp/testdir
[root@localhost ~]# setfacl -d -m g:g3:r /tmp/testdir
[root@localhost ~]# setfacl -d -m o::- /tmp/testdir

4.让普通用户有能力使用cat文件阅读/etc/shadow文件

[root@localhost ~]# setfacl -m u:redhat:r /etc/shadow
[root@localhost ~]# su - redhat
[redhat@localhost ~]$ cat /etc/shadow
root:$6$YI1IZkJJq5MCf.E9$roilBCbadTJgMRxEp9rGX48.HYyQR8CohBoKD40mhplB/4rwfiAf.ocsW5gqDJzb.EPDKZsXYDlVZVAiohAf71::0:99999:7:::
bin:*:19347:0:99999:7:::
daemon:*:19347:0:99999:7:::
adm:*:19347:0:99999:7:::
lp:*:19347:0:99999:7:::
sync:*:19347:0:99999:7:::

5.创建/tmp/aaaa/目录,该目录中的文件只能文件拥有者可以删除

[root@localhost ~]# mkdir -p /tmp/aaaa/
[root@localhost ~]# chmod 700 /tmp/aaaa/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值