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
 

相关推荐

  1. 作业..........

    2024-04-27 10:08:02       55 阅读
  2. c yuv422转yuv420p

    2024-04-27 10:08:02       54 阅读
  3. mysql机试题笔记425

    2024-04-27 10:08:02       27 阅读
  4. MySQL45讲(一)(42)

    2024-04-27 10:08:02       28 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-27 10:08:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-27 10:08:02       100 阅读
  3. 在Django里面运行非项目文件

    2024-04-27 10:08:02       82 阅读
  4. Python语言-面向对象

    2024-04-27 10:08:02       91 阅读

热门阅读

  1. DevOps转型的意义:加速创新、提高效率

    2024-04-27 10:08:02       26 阅读
  2. Rust 字符串基本使用教程及代码演示

    2024-04-27 10:08:02       32 阅读
  3. DRF 权限介绍

    2024-04-27 10:08:02       25 阅读
  4. 如何在ubuntu 24.04上安装配置x11vnc以便远程访问

    2024-04-27 10:08:02       36 阅读
  5. Python pip安装如何切换国内源

    2024-04-27 10:08:02       34 阅读
  6. 【Linux】tr命令删除空格,sed替换空行

    2024-04-27 10:08:02       32 阅读
  7. MyBatis特殊SQL的执行

    2024-04-27 10:08:02       41 阅读
  8. windows Server 2012精讲系列课程

    2024-04-27 10:08:02       27 阅读
  9. Leetcode 347:前K个高频元素

    2024-04-27 10:08:02       22 阅读
  10. Markdown生成word和pdf

    2024-04-27 10:08:02       30 阅读
  11. k8s笔记 | StatefulSet 有状态

    2024-04-27 10:08:02       34 阅读