RHCSA学习第六天

1、新建目录要求如下:

1)/pub目录为公共存储目录对所有用户可以读,写,执行,但用户只能删除属于自己的文件(t权限)

[root@localhost ~]# ls -al /pub
total 0
drwxrwxrwt.  2 root root   6 Feb 17 19:12 .
[root@localhost ~]# ls -al /pub
total 0
drwxrwxrwt.  2 root root   6 Feb 17 19:12 .

2)/sc目录为生产部存储目录只能对生产部人员可以写入,并且生产部人员该目录所建立的文件都自动归属到shenchan组中

[root@localhost ~]# groupadd shenchan
[root@localhost ~]# chgrp shenchan /sc
[root@localhost ~]# chmod 774 /sc
[root@localhost ~]# chmod g+s /sc
[root@localhost ~]# ls -al /sc
total 0
drwxrwsr--.  2 root shenchan   6 Feb 17 19:12 .

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

[root@localhost ~]# groupadd caiwu
[root@localhost ~]# chgrp caiwu /cw
[root@localhost ~]# chmod 774 /cw
[root@localhost ~]# chmod g+s /cw
[root@localhost ~]# ls -al /cw
total 0
drwxrwsr--.  2 root caiwu   6 Feb 17 19:13 .

4) admin用户对于/sc和/cw目录可以读,写,执行

[root@localhost ~]# useradd admin
[root@localhost ~]# setfacl -m u:admin:rwx /cw
[root@localhost ~]# setfacl -m u:admin:rwx /sc
[root@localhost ~]# su - admin
[admin@localhost ~]$ cd /cw
[admin@localhost cw]$ touch aaa
[admin@localhost cw]$ ll
total 0
-rw-rw-r--. 1 admin caiwu 0 Feb 17 19:36 aaa
[admin@localhost cw]$ cd /sc
[admin@localhost sc]$ touch bbb
[admin@localhost sc]$ ll
total 0
-rw-rw-r--. 1 admin shenchan 0 Feb 17 19:36 bbb
[admin@localhost sc]$ rm /cw/aaa
[admin@localhost sc]$ rm /sc/bbb
[admin@localhost sc]$ ll /sc
total 0
[admin@localhost sc]$ ll /cw
total 0

2、设置特殊权限,要求如下:

1)创建目录/test/data,让 it 组内普通用户对其有写权限,且创建的所有文件的属组为目录所属的组,此外,每个用户仅能删除自己的文件

[root@localhost ~]# mkdir -p /test/data
[root@localhost ~]# groupadd it
[root@localhost ~]# chgrp it /test/data
[root@localhost ~]# chmod 774 /test/data
[root@localhost ~]# chmod o+t /test/data
[root@localhost ~]# ls -al /test/data
total 0
drwxrwsr-T. 2 root it    6 Feb 17 19:39 .

2)让普通用户能使用/tmp/cat去查看用户配置文件

[root@localhost ~]# chmod u+s /test/data

3、设置ACL权限,要求如下:

在/test/dir里创建的新文件自动属于webs组

[root@localhost ~]# chgrp webs /test/dir
[root@localhost ~]# ls -al /test/dir
total 0
drwxr-xr-x. 2 root webs  6 Feb 17 20:40 .

组apps的成员如:tomcat能对这些新文件有读写权限,

组dbs的成员如:mysql只能对新文件有读权限,

其它用户(不属于webs,apps,dbs)不能访问这个文件夹

[root@localhost ~]# groupadd apps
[root@localhost ~]# groupadd dbs
[root@localhost ~]# useradd tomcat 
[root@localhost ~]# useradd mysql
[root@localhost ~]# gpasswd -a tomcat apps
Adding user tomcat to group apps
[root@localhost ~]# gpasswd -a mysql dbs
Adding user mysql to group dbs
[root@localhost ~]# chmod g+s /test/dir
[root@localhost ~]# setfacl -m g:apps:wr /test/dir
[root@localhost ~]# setfacl -m g:dbs:wr /test/dir
[root@localhost ~]# chmod o-wrx /test/dir

1、配置网络

  为网卡添加一个本网段静态IPV4地址,x.x.x.123

[root@localhost ~]# nmcli connection modify ens160 +ipv4.address 192.168.10.123/24 
[root@localhost ~]# nmcli connection up ens160
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)
[root@localhost ~]# ip a
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:0c:29:f7:a9:62 brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.129/24 brd 192.168.10.255 scope global dynamic noprefixroute ens160
       valid_lft 1795sec preferred_lft 1795sec
    inet 192.168.10.123/24 brd 192.168.10.255 scope global secondary noprefixroute ens160
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fef7:a962/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever


                
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北川Cc丶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值