第三次作业

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

相关推荐
SelectDB14 小时前
Litefuse 开源并推出单进程轻量模式,25 秒就能跑起来的 Agent 可观测与评估平台
运维·后端·自动化运维
AlfredZhao15 小时前
Docker 容器时区不对,`timedatectl` 不存在怎么办?
linux·timezone
zzzzzz3102 天前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
XIAOHEZIcode2 天前
Linux系统鼠标偏移常见原因以及修复方案
linux·运维·游戏
用户0328472220703 天前
如何搭建本地yum源(上)
运维
A小辣椒4 天前
TShark:Wireshark CLI 功能
linux
A小辣椒4 天前
TShark:基础知识
linux
AlfredZhao4 天前
OCI 明明分配了 200G 系统盘,为什么 df 只看到 30G?
linux·oci
AlfredZhao5 天前
vi 删除指定范围的行,不用再反复按 dd
linux·vi
用户9718356334665 天前
银河麒麟 KY10 申威(SW64) 安装 nginx-1.16.1-2.p01.ky10.sw_64.rpm 详细步骤
linux