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

相关推荐
liebe1*12 分钟前
第七章 防火墙地址转换
运维·服务器·网络
好好学操作系统8 分钟前
autodl 保存 数据 跨区
linux·运维·服务器
dbitc10 分钟前
WIN11把WSL2移动安装目录
linux·运维·ubuntu·wsl
KingRumn10 分钟前
Linux同步机制之信号量
linux·服务器·网络
嵌入式学习菌10 分钟前
SPIFFS文件系统
服务器·物联网
旺仔Sec11 分钟前
2026年度河北省职业院校技能竞赛“Web技术”(高职组)赛项竞赛任务
运维·服务器·前端
BullSmall31 分钟前
linux 根据端口查看进程
linux·运维·服务器
herinspace36 分钟前
管家婆软件年结存后快马商城操作注意事项
服务器·数据库·windows
_F_y42 分钟前
Linux:进程间通信
linux
嘻哈baby43 分钟前
Ansible自动化运维入门:从手工到批量部署
运维·自动化·ansible