4.25 作业

#1、创建g1组,要求创建一个属于redhat用户g1组的文件redhat.txt

root@localhost \~# groupadd g1

root@localhost \~# touch /root/redhat.txt

root@localhost \~# ll /root/redhat.txt

-rw-r--r--. 1 root root 0 4月 26 20:19 /root/redhat.txt

root@localhost \~# chown xnj1 redhat.txt

root@localhost \~# chgrp g1 redhat.txt

root@localhost \~# ll /root/redhat.txt

-rw-r--r--. 1 xnj1 g1 0 4月 26 20:19 /root/redhat.txt

#2、新建/sc目录,所属组为group组,root用户和group组用户可在该目录下创建文件,其他人无任何权限

root@localhost \~# groupadd group

root@localhost \~# mkdir /sc

root@localhost \~# ll -d /sc

drwxr-xr-x. 2 root root 6 4月 26 20:34 /sc

root@localhost \~# chmod o-rw /sc

root@localhost \~# ll -d /sc

drwxr-x--x. 2 root root 6 4月 26 20:34 /sc

root@localhost \~# chmod o-x /sc

root@localhost \~# ll -d /sc

drwxr-x---. 2 root root 6 4月 26 20:34 /sc

root@localhost \~# chmod g+w /sc

root@localhost \~# ll -d /sc

drwxrwx---. 2 root root 6 4月 26 20:34 /sc

#3、新建/cw目录为财务部存储目录,只能对财务部人员可以写入,并且财务部人员所建立的文件都自动属于mygroup组中

root@localhost \~# mkdir /cw

root@localhost \~# groupadd mygroup

root@localhost \~# chgrp mygroup /cw

root@localhost \~# ll -d /cw

drwxr-xr-x. 2 root mygroup 6 4月 26 20:37 /cw

root@localhost \~# chmod o-rx /cw

root@localhost \~# chmod g+w /cw

root@localhost \~# ll -d /cw

drwxrwx---. 2 root mygroup 6 4月 26 20:37 /cw

#4、设置helen用户对于/sc和/cw目录可读、可写、可执行

root@localhost \~# useradd helen

root@localhost \~# chmod 777 /sc

root@localhost \~# chmod 777 /cw

#5、设置/test目录为公共存储目录,对所有用户可以读、写、执行,但用户只能删除属于自己的文件。

root@localhost \~# mkdir /test

root@localhost \~# chmod 777 /test

root@localhost \~# chmod o+t /test

root@localhost \~# ll -d /test

drwxrwxrwt. 2 root root 6 4月 26 20:53 /test

#6、在/test/dir里创建的新文件自动属于temp组

root@localhost \~# mkdir /test/dir

root@localhost \~# groupadd temp

root@localhost \~# ll -d /test/dir

drwxr-xr-x. 2 root root 6 4月 26 20:58 /test/dir

root@localhost \~# chgrp temp /test/dir

root@localhost \~# chmod g+s /test/dir

root@localhost \~# chmod g+w /test/dir

root@localhost \~# chmod o+w /test/dir

相关推荐
Web3探索者1 天前
可视化服务器管理和传统命令行区别是什么?新手教程:Linux 运维到底该用图形界面还是 SSH 命令行?
linux·ssh
zylyehuo1 天前
Linux系统中网线与USB网络共享冲突
linux
荣--1 天前
一键部署不是为了省时间 —— 它是把"买来的 PaaS"变成"自己的平台"的拐点
运维·zabbix·工程化·一键部署·平台化·边界设计
江华森1 天前
动手实战学 Docker — 从零到集群编排完全指南
运维
Avan_菜菜2 天前
FRP 内网穿透完整实战:从 HTTP 映射到 HTTPS 自签代理
运维·nginx·https
Sokach10152 天前
Linux Shell 脚本从零到能用:一个新手的一天学习总结
linux
SelectDB3 天前
Litefuse 开源并推出单进程轻量模式,25 秒就能跑起来的 Agent 可观测与评估平台
运维·后端·自动化运维
AlfredZhao3 天前
Docker 容器时区不对,`timedatectl` 不存在怎么办?
linux·timezone
zzzzzz3104 天前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
XIAOHEZIcode5 天前
Linux系统鼠标偏移常见原因以及修复方案
linux·运维·游戏