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