第三次作业

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

相关推荐
艾莉丝努力练剑25 分钟前
OpenCode AI 编程:Ubuntu 24.04 环境安装与使用指南
linux·服务器·网络·人工智能·tcp/ip·ubuntu
崇山峻岭之间41 分钟前
Keil5输出hex转换为bin的设置
linux·运维·服务器
Hoxy.R1 小时前
KingbaseES读写分离高可用集群扩容、备库重建与故障切换实战
运维·数据库
谷雪_6581 小时前
Linux 网络命名空间:从内核原理到企业级容器网络架构全景实战
linux·网络·架构
Tian_Hang2 小时前
Eclipse Ditto 的权限策略
java·服务器·前端·网络·ide·ubuntu·eclipse
qq_163135752 小时前
Linux 【03- chgrp命令超详细教程】
linux
考虑考虑3 小时前
nginx配置ssl
运维·后端·nginx
我会尽全力 乐观而坚强3 小时前
MySQL库与表的操作
linux·数据库·mysql
着迷不白3 小时前
Linux 磁盘管理完全指南:分区、文件系统、挂载与 LVM 实战
linux·运维·服务器
山川而川-R3 小时前
LangChain
linux·运维·服务器