第三次作业

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

相关推荐
Learn-Share_HY12 分钟前
[Linux]如何設置靜態IP位址?
linux·运维·tcp/ip·ubuntu·static ip
Everbrilliant891 小时前
Ubuntu系统下交叉编译Android的X265库
linux·运维·ubuntu·x265交叉编译·android x265·ffmpeg x265
我不要放纵1 小时前
LVS集群搭建
linux·服务器·lvs
阿巴~阿巴~1 小时前
自主Shell命令行解释器
linux·运维·服务器
许白掰1 小时前
Linux入门篇学习——借助 U 盘或 TF 卡拷贝程序到开发板上
linux·学习·借助 u 盘拷贝程序到开发板上·借助 tf卡拷贝程序到开发板上
小周学学学1 小时前
docker安装与简单项目上手
运维·docker·容器
SHUIPING_YANG2 小时前
根据用户id自动切换表查询
java·服务器·数据库
chao_7892 小时前
更灵活方便的初始化、清除方法——fixture【pytest】
服务器·自动化测试·python·pytest
枷锁—sha2 小时前
【DVWA系列】——CSRF——Medium详细教程
android·服务器·前端·web安全·网络安全·csrf
枷锁—sha2 小时前
跨站请求伪造漏洞(CSRF)详解
运维·服务器·前端·web安全·网络安全·csrf