RHCSA---shell和用户组管理思维导图

一、完成第七章,第八章课后思维导图总结

RHCSA---shell和用户组管理思维导图_第1张图片

RHCSA---shell和用户组管理思维导图_第2张图片

二、完成如下题目,并展示你的命令

1、设置权限,要求如下:

(1)创建g1组,要求创建一个属于redhat用户g1组的文件redhat.txt [root@localhost ~]# groupadd g1

// 创建g1组

[root@localhost ~]# useradd redhat

// 添加新用户redhat

[root@localhost ~]# touch redhat.txt

// 创建redhat.txt文件

[root@localhost ~]# chown redhat:g1 redhat.txt

// 其中,redhat为修改后文件所属的用户,g1为所属的组,redhat.txt为想要操作的文件。

(2)新建/sc目录,所属组为group组,root用户和group组用户可在该目录下创建文件,其他人无任何权限所有用户生效的命令别名

[root@localhost ~]# mkdir sc

// 创建sc文件目录

[root@localhost ~]# groupadd group

//创建group组

[root@localhost ~]# chgrp group sc

//修改sc所属组

[root@localhost ~]# chmod -R 770 sc

设置sc文件权限为770

RHCSA---shell和用户组管理思维导图_第3张图片

2、写一个所有用户都生效的命令别名为hh,每一个用户输入这个命令之后可以在该用户家目录下创建一个file1 文件。

[root@localhost ~]# vim /etc/bashrc

输入快捷命令如下图:

RHCSA---shell和用户组管理思维导图_第4张图片

[root@localhost ~]# source ~/.bashrc

// 让alias永久化

[root@localhost ~]# hh

[root@localhost ~]# su redhat

[redhat@localhost root]$ hh

[redhat@localhost root]$

检测即可

你可能感兴趣的:(作业,RHCSA,思维导图,linux)