第三次作业

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

相关推荐
myy-learn14 分钟前
31-TCP并发
服务器·网络·tcp/ip
名字还没想好☜20 分钟前
Docker buildx 多架构镜像实战:一次构建 amd64+arm64,告别 exec format error
运维·docker·eureka·架构·kubernetes
智购科技无人售货机厂家37 分钟前
2026自动售货机备用电池管理系统设计:从充放电保护到健康监测的工程实践~YH
大数据·linux·单片机·嵌入式硬件·微信
小雪崩39 分钟前
嵌入式学习 day39:TCP并发服务器模型
linux·服务器·c语言·网络·学习·tcp/ip
智购无人售货机厂家1 小时前
2026自动售货机软硬件版本管理策略:从版本号规范到兼容性矩阵的工程实践~YH
运维·服务器·人工智能·单片机·嵌入式硬件·线性代数·矩阵
spencer_tseng1 小时前
[j2cache ehcache.xml]/tmp/.ehcache-diskstore.lock (Permission denied)
xml·linux·python·ehcache·[j2cache
内核笔记1 小时前
休眠唤醒 standby 调试
linux·bsp
小白不想画工图1 小时前
银河麒麟V10系统安装QT5.12
linux·开发语言·qt·银河麒麟
bksczm1 小时前
Linux 五种 I/O 模型与多路复用详解
运维·服务器·网络
wjcroom1 小时前
FileBrowser的docker运行了改变密码长度的做法
运维·docker·容器