第三次作业

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服务-Bonding网卡绑定工具
linux·运维·linux bonding·网卡绑定
云边有个稻草人6 分钟前
Windows 里用 Linux 不卡顿?WSL + cpolar让跨系统开发变简单
linux·运维·服务器·cpolar
打不了嗝 ᥬ᭄8 分钟前
【Linux】网络层协议
linux·网络·c++·网络协议·http
卓码软件测评18 分钟前
软件数据库测试:【数据库质量保障:从单元测试到性能优化】
运维·数据库·测试用例·压力测试
LXY_BUAA29 分钟前
将linux操作系统装入U盘20251107
linux·运维·服务器
IDC02_FEIYA1 小时前
Discuz论坛管理员怎么重置修改用户密码?
运维·服务器
九河云1 小时前
华为云ECS与Flexus云服务器X实例:差异解析与选型指南
大数据·运维·服务器·网络·人工智能·华为云
kaoa0001 小时前
Linux入门攻坚——53、drbd - Distribute Replicated Block Device,分布式复制块设备-2
linux·运维·服务器
007tg1 小时前
Telegram SCRM 系统构建指南:自动化营销与客户管理实战
大数据·运维·自动化
King's King1 小时前
自动化化WMS和WCS投标模板
运维·自动化