Linux System Administration 05- ownership rights and management

1. Create / guanli directory, create two directories zonghe and jishu (a command) in / guanli

[root @ localhost ~] # mkdir -p / guanli / Zonghe | mkdir -p / guanli /. Journal

[root@localhost ~]# ls /guanli
jishu zonghe

2, add a group account zonghe, caiwu, jishu, GID numbers are set to 2001, 2002

[root@localhost ~]# groupadd -g 2001 zonghe
[root@localhost ~]# groupadd -g 2002 caiwu

[root@localhost ~]# groupadd -g 2003 jishu

[root@localhost ~]# tail -5 /etc/group
tcpdump:x:72:
zxs:x:1000:
zonghe:x:2001:
caiwu:x:2002:
jishu:x:2003:

 

3. Create jerry, kylin, tsengia, obama user, which kylin user account expire after 30 December 2020

[root@localhost ~]# useradd jerry

[root@localhost ~]# useradd -e 2020-12-30 kylin

[root@localhost ~]# useradd tsengia
[root@localhost ~]# useradd obama

[root@localhost ~]# tail -4 /etc/shadow
jerry:!!:18107:0:99999:7:::
tsengia:!!:18107:0:99999:7:::
obama:!!:18107:0:99999:7:::
kylin:!!:18107:0:99999:7::18626:

 

4, adding jerry, kylin, tsengia, obama other users into groups zonghe

[root@localhost ~]# gpasswd -M jerry,kylin,tsengia,obama zonghe

[root@localhost ~]# tail -10 /etc/group
stapdev:x:158:
tcpdump:x:72:
zxs:x:1000:
zonghe:x:2001:jerry,kylin,tsengia,obama
caiwu:x:2002:
jishu:x:2003:
jerry:x:1001:
tsengia:x:1003:
obama:x:1004:
kylin:x:1005:

 

5, create a handy, cucci users, cucci account login Shell is set to "/ sbin / nologin"

[root@localhost ~]# useradd handy
[root@localhost ~]# useradd -s /sbin/nologin cucci

 

6, adding handy, cucci other users into groups jishu

[root@localhost ~]# gpasswd -M handy,cucci jishu
[root@localhost ~]# tail -10 /etc/group
zxs:x:1000:
zonghe:x:2001:jerry,kylin,tsengia,obama
caiwu:x:2002:
jishu:x:2003:handy,cucci
jerry:x:1001:
tsengia:x:1003:
obama:x:1004:
kylin:x:1005:
handy:x:1006:
cucci:x:1007:

 

7, all users are required to be added to the aforementioned group within guanli

[root@localhost ~]# groupadd guanli
[root@localhost ~]# gpasswd -M jerry,kylin,tsengia,obama,handy,cucci guanli

 

8, obama users in zonghe group deleted

[root @ localhost ~] # gpasswd -d obama Zonghe
is the user "obama" delete from "zonghe" group

 

9, set a password for the user jerry is "123456" (using conventional methods)

 

Cucci set a password for the user "redhat" (use --stdin method)

 

10, the jerry user to lock and view the locked state

 

11, two xshell open windows, by (who or w) command to check the connection status, and wherein through a fuser kill

 

12, see cucci users belong to those groups, and to view its details

 

13, manually create an account student

 

14, set permissions and ownership:
/ guanli directory is a group set guanli
is a group / guanli / zonghe directory to Zonghe
/ guanli / directory is a group jishu set jishu
set up three directories are prohibited other user access rights

 

15, to establish a public directory / ceshi
allow all users in the technical group read, write, execute the file
prohibit other users to read, write, execute

 

16, clear the user password jerry

 

17, locking the user's password and view the status cucci

 

18, the user's UID is modified obama 8888

 

19, kylin modify the user's password by using the passwd command a maximum period of 60 days

 

20, see the user handy information id groups finger commands

 

Guess you like

Origin www.cnblogs.com/wangjia120/p/11271169.html