Account management operation questions

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

[the root @ localhost ~] #  mkdir -pv / Guanli [/ Zonghe {,}. Journal

mkdir: we have created the directory "/ guanli"

mkdir: we have created the directory "/ guanli / zonghe"

mkdir: we have created the directory "/ guanli / jishu"

[root@localhost ~]# ls /guanli

jishu zonghe

2 , add a group account Zonghe , caiwu , . Journal , GID numbers are set to 2001 , 2002 , 2003

[root@localhost ~]#groupmod -g 2001 zonghe

[root@localhost ~]#groupmod -g 2002 caiwu

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

3 , create Jerry , kylin , tsengia , obama user, which kylin user account in 2020 Nian 12 Yue 30 failures in the future

[root@localhost ~]# groupadd zonghe

[root@localhost ~]# groupadd caiwu

[root@localhost ~]# groupadd jishu

[root@localhost ~]# groupmod -g 2001 zonghe

[root@localhost ~]# groupmod -g 2002 caiwu

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

4 , the Jerry , Kylin , tsengia , Obama add other users to zonghe the group

[root@localhost ~]# useradd jerry

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

[root@localhost ~]# useradd tsengia

[root@localhost ~]# useradd obama

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

[root@localhost ~]# useradd handy

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

6 , the Handy , CUCCI add other users to jishu the group

[root@localhost ~]# gpasswd -a handy jishu

The user is " Handy " added to " . Journal " group,

[root@localhost ~]# gpasswd -a cucci jishu

The user is " CUCCI " added to " . Journal " group,

7 , all users are required to be added to the above-described guanli the group

[root@localhost ~]# groupadd guanli

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

8 , the zonghe in the group obama user deletes

[root@localhost ~]# gpasswd -d obama zonghe

The user is " obama " from " Zonghe delete" group

9 , as jerry set password of the user to " 123456 " (using conventional methods)

[root@localhost ~]# passwd jerry

Changing user jerry password.

New Password:

Invalid Password: password less than 8 characters.

Re-enter the new password:

passwd : all authentication tokens have been successfully updated.

As cucci set a password for the user " RedHat " (use --stdin method)

[root@localhost ~]# echo "redhat" | passwd jerry --stdin

Changing user jerry password.

passwd : all authentication tokens have been successfully updated.

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

[root@localhost ~]# usermod -L jerry

[root@localhost ~]# passwd -s jerry

11 , two open xshell window through ( WHO or W ) command to check the connection status, and by fuser kill one

[root@localhost ~]# fuser -k /dev/pts/0

/dev/pts/0:          80571 80604

12 , see cucci user belonging to those groups, and to view its details

[root@localhost ~]# finger cucci

Login: cucci           Name:

Directory: /home/cucci               Shell: /sbin/nologin

Never logged in.

No mail.

No Plan.

[root@localhost ~]# groups cucci

Cucci: Cucci Jishu

13 , manually create an account student

14 , set permissions and ownership:

   / guanli directory is a group set guanli

   / guanli / zonghe is a group directory to zonghe

   / guanli / jishu is a group directory to jishu

   Set 3 directories are prohibited other user access rights

[the root @ localhost ~] #  chown: Guanli [/ Guanli [/

[the root @ localhost ~] # chown: Zonghe / Guanli [/ Zonghe

[the root @ localhost ~] #  chown:. Journal / Guanli [/. Journal

[root@localhost ~]# chown -R 750 /guanli

15 , to establish a public directory / ceshi

   Technology allows all users within the group of read, write, execute the file

   Prohibit other users to read, write, execute

[root@localhost ~]# mkdir -pv /tmp/ceshi

mkdir: you have created the directory "/ tmp / ceshi"

[root@localhost ~]# setfacl -m g:jishu:rwx /tmp/ceshi/

[root@localhost ~]# chown -R 750 /tmp/ceshi/

16 , Clear jerry user password

[root@localhost ~]# passwd -d jerry

Clear user password Jerry .

passwd: Successful operation

17 , locking cucci password and view status

[root@localhost ~]# passwd -l cucci

Lock the user cucci password.

passwd: Successful operation

[root@localhost ~]# passwd -S cucci

cucci LK 2019-07-30 0 99999 7 -1 ( password is locked. )

18 , modified obama user UID to 8888

[root@localhost ~]# usermod -u 8888 obama

19 , by passwd modify the command kylin user maximum password age is 60 Tian

[root@localhost ~]# passwd -x 60 kylin

Adjust the user password aging data Kylin .

passwd: Successful operation

20 , by id groups finger view the user commands such handy information

[root@localhost ~]# id -a handy

uid = 1007 (handy) gid = 1007 (handy) = 1007 (handy), 2003 ( jishu)

[root@localhost ~]# groups handy

handy: handy jishu

[root@localhost ~]# finger handy

Login: handy           Name:

Directory: /home/handy               Shell: /bin/bash

Never logged in.

No mail.

No Plan.

Guess you like

Origin www.cnblogs.com/990114-jhc/p/11272743.html