第三次作业

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

相关推荐
Leinwin几秒前
微软上线 Deep Research 预览版:o3+必应赋能研究自动化
运维·microsoft·自动化
不脱发的程序猿21 分钟前
SoC程序如何使用单例模式运行
linux·嵌入式
F36_9_29 分钟前
团队协作效率低影响项目进度,如何提升效率
运维
hie9889436 分钟前
CentOS环境搭建-快速升级G++版本
linux·python·centos
星辰云-38 分钟前
【超详细】CentOS系统Docker安装与配置一键脚本(附镜像加速配置)
linux·docker·centos
ajassi20001 小时前
开源 Arkts 鸿蒙应用 开发(六)数据持久--文件和首选项存储
linux·开源·harmonyos
厚道1 小时前
如何管理和优化内核参数?
linux
小立爱学习1 小时前
Linux 内存管理之address_space
linux·c语言
CodeWithMe1 小时前
【Note】Linux Kernel 之 内核架构、源码文件、API/ABI 、FHS
linux·运维·架构
SKYDROID云卓小助手1 小时前
无人设备遥控器之无线电频率篇
服务器·网络·单片机·嵌入式硬件·算法