第三次作业

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--

相关推荐
2501_901147832 分钟前
学习笔记:单调递增数字求解的迭代优化与工程实践
linux·服务器·笔记·学习·算法
似霰9 分钟前
Linux timerfd 的基本使用
android·linux·c++
2501_9248787320 分钟前
AdAgent 能力成熟度模型:从 L1 自动化到 L5 自主增长引擎
运维·自动化
寄存器漫游者22 分钟前
Linux 软件编程 命令、内核与 Shell
linux·运维·服务器
Kaede637 分钟前
服务器硬件防火墙和软件防火墙的区别
运维·服务器
qinyia44 分钟前
通过本地构建解决Cartographer编译中absl依赖缺失问题
linux·运维·服务器·mysql·ubuntu
郝亚军1 小时前
ubuntu启一个udp server,由一个client访问
linux·ubuntu·udp
苦逼IT运维1 小时前
从 0 到 1 理解 Kubernetes:一次“破坏式”学习实践(一)
linux·学习·docker·容器·kubernetes
萧曵 丶1 小时前
Docker 面试题
运维·docker·容器
七牛云行业应用1 小时前
3.5s降至0.4s!Claude Code生产级连接优化与Agent实战
运维·人工智能·大模型·aigc·claude