第三次作业

1.在/home中创建一个名为 file1.txt 的文件,并设置权限为:所有者和组成员可以读写,但其他人只能读。

root@localhost home\]# touch file1.txt \[root@localhost home\]# ll -rw-r--r--. 1 root root 0 11月 11 23:06 file1.txt \[root@localhost home\]# chmod 774 file1.txt \[root@localhost home\]# ll -rwxrwxr--. 1 root root 0 11月 11 23:06 file1.txt 2.在 /home 目录下创建一个名为 shared 的子目录,使得所有用户都可以进入,读,写,该目录中文件。 \[root@localhost home\]# mkdir shared \[root@localhost home\]# chmod 777 shared \[root@localhost home\]# ll drwxrwxrwx. 2 root root 6 11月 11 23:37 shared 3.在/home中创建一个file2.txt,添加不可修改文件属性。 \[root@localhost home\]# chattr +i file2.txt \[root@localhost home\]# rm -rf \* rm: 无法删除 'file2.txt': 不允许的操作 4.给cat命令添加suid权限,使得普通用户可以使用cat查看/etc/shadow文件。 \[root@localhost /\]# chmod u+s /bin/cat \[root@localhost /\]# ll /bin/cat -rwsr-xr-x. 1 root root 36520 1月 29 2024 /bin/cat \[xiao@localhost /\]$ cat /etc/shadow 5.给file2.txt添加acl权限让redhat不可该文件做任何操作 \[root@localhost home\]# setfacl -m u:redhat:--- file2.txt \[root@localhost home\]# getfacl file2.txt # file: file2.txt # owner: root # group: root user::rw- user:redhat:--- group::r-- mask::r-- other::r-- 6.删除file2.txt的扩展权限 \[root@localhost home\]# setfacl -b file2.txt \[root@localhost home\]# getfacl file2.txt # file: file2.txt # owner: root # group: root user::rw- group::r-- other::r--

相关推荐
平生不喜凡桃李16 分钟前
Linux网络层:IP
linux·运维·tcp/ip
塔能物联运维33 分钟前
物联网设备运维中的自动化合规性检查与策略执行机制
java·运维·物联网·struts·自动化
阿方索38 分钟前
虚拟化技术实践指南:KVM 与 VMware ESXi 部署全流程
linux·运维·服务器
PellyKoo38 分钟前
Docker容器中中文文件名显示乱码问题完美解决方案
运维·docker·容器
YouEmbedded1 小时前
解码Linux文件IO之库的制作与应用
linux·动态库·静态库
野犬寒鸦1 小时前
从零起步学习MySQL || 第八章:索引深入理解及高级运用(结合常见优化问题讲解)
java·服务器·数据库·后端·mysql
有谁看见我的剑了?2 小时前
Rocky 9 单机安装elastic-9.1.5
运维·elk
Gss7772 小时前
ELK 日志管理系统相关内容总结
运维·elk
半梦半醒*2 小时前
ELK1——elasticsearch
linux·运维·数据仓库·elasticsearch·centos
tongsound2 小时前
记录一次崩溃问题排查过程(gtsam库相关,avx)
linux·c++