第三次作业

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

相关推荐
2301_816374336 分钟前
Nginx下构建PC站点
java·运维·nginx
Run_Teenage12 分钟前
Linux:线程互斥,线程锁
运维·开发语言·jvm
DigitalOcean31 分钟前
DigitalOcean VPC 网络故障排查 Runbook 实战指南
运维·服务器
Damon小智40 分钟前
腾讯云轻量服务器部署 OpenClaw + QClaw 全流程实践:打造随时在线的个人 AI 助手
服务器·云计算·腾讯云
嵌入式×边缘AI:打怪升级日志1 小时前
Tina SDK Linux Kernel 基本使用(实战篇:为开发板添加用户按键驱动支持)
linux·运维·服务器
日取其半万世不竭1 小时前
Excalidraw 自建部署指南:白板协作工具完全私有化
服务器·网络·数据库
瞎折腾啥啊1 小时前
VCPKG详细使用教程
linux·c++·cmake·cmakelists
我是Superman丶1 小时前
Docker 命令自用
运维·docker·容器
网络笨猪1 小时前
Nginx企业级高频场景配置大全
运维·nginx
爱莉希雅&&&1 小时前
MySQL MGR + MySQL Router 高可用集群完整笔记(含手动配置 + Shell 接管双路线)
linux·数据库·笔记·mysql·mysqlrouter·mysqlshell