第三次作业

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

相关推荐
未济3 天前
linux 配置环境变量
linux
傲世仙尊3 天前
目录即文件-Ext文件系统收尾篇
linux·c语言
虎头金猫3 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
_艾伦 耶格尔.3 天前
进程间通信
linux
AI职业加油站3 天前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
Liuqy-053 天前
Linux IO编程——静态库、动态库
linux
此冬歌咏3 天前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
彧azz3 天前
Linux 环境下 Redis 学习总结:数据类型、持久化、锁、事务、主从与缓存问题
linux·redis·笔记·学习·面试
-梅3 天前
linux(8) 软硬链接
linux·运维·服务器
Wang's Blog3 天前
Java 项目实战: 外卖平台-文件下载与ServletOutputStream回写浏览器
服务器·项目开发