User management operations

1. Create / guanli directory, create two directories zonghe and jishu (a command) in / guanli
[root @ localhost ~] # mkdir -pv / guanli / zonghe | mkdir -p / guanli / jishu
[root @ localhost ~] LS # / guanli
. Journal Zonghe

2, add a group account zonghe, caiwu, jishu, GID numbers are set to 2001,2002,2003
[root @ localhost ~] # groupadd -g 2001 Zonghe
[root @ localhost ~] # groupadd -g 2002 caiwu
[root @ localhost ~ ] # groupadd -g 2003 jishu

3. Create jerry, kylin, tsengia, obama user, which kylin user account failure in December 2020 after 30
[root @ localhost ~] # groupadd -g 2001 Zonghe
[root @ localhost ~] # groupadd -g 2002 caiwu
[ ~ @ localhost root] # groupadd -g 2003. Journal
[root @ localhost ~] # the usermod -e 2020-12-30 Kylin

4, adding jerry, kylin, tsengia, obama Zonghe into other user groups.
[The root @ localhost ~] # the gpasswd -M jerry, kylin, tsengia, obama Zonghe

5, create a handy, cucci users, cucci account login Shell is set to "/ sbin / nologin"
[root @ localhost ~] # useradd Handy | useradd -s / sbin / nologin cucci

6, adding handy, cucci into other user groups. Journal
[root @ localhost ~] # gpasswd -M handy, cucci jishu

7, all users are required to be added to the above-described inner guanli group
[the root @ localhost ~] # guanli the groupadd
[the root @ localhost ~] # Jerry the gpasswd -M, Kylin, tsengia, Obama, Handy, CUCCI guanli

8, obama users in zonghe group delete
[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)
[the root @ localhost ~] # the passwd jerry
change the user's password jerry.
The new password:
Invalid Password: password less than eight characters
Re-enter the new password:
passwd: all authentication tokens have been successfully updated.
   Cucci user password is set to "redhat" (use --stdin method) 
[root @ localhost ~] # echo "RedHat" | passwd --stdin cucci
change a user's password cucci.
passwd: all authentication tokens have been successfully updated.
10, the jerry user to lock and view the locked state
[root @ localhost ~] # passwd -l jerry
locked jerry user's password.
passwd: Successful operation
11, two xshell open windows, by (who or w) command to check the connection status, and wherein through a fuser kill
[the root @ localhost ~] # WHO
Han: 2019-07-30 08:22 0 (: 0)
Han PTS / 0 2019-07-30 08:22 (: 0)
the root PTS / 2019-07-30. 1 08:24 (192.168.100.171)
the root PTS / 2 2019-07-30 10:17 (192.168.100.171)
[ ~ @ localhost the root] # the fuser -k / dev / PTS / 2
\ / dev / PTS / 2: 4528
12, see cucci user belonging to those groups, and to view its details
[root @ localhost ~] # finger cucci
the Login: cucci the Name:
Directory: / Home / cucci Shell: / sbin / nologin
. Never logged in
. No mail
No Plan .
[the root @ localhost ~] # CUCCI ID
UID = 1006 (CUCCI) GID = 1006 (CUCCI) group = 1006 (cucci), 2003 ( jishu), 2005 (guanli)
13, manually create accounts Student
[root @ localhost skel] # mkdir / Student
[root @ localhost skel] # LS -a | .b * cp / Student /
[root @ localhost skel] # vim / etc / passwd

student:x:1008:1008::/home/student:/bin/bash
14, set permissions and ownership:
   / guanli directory is a group set guanli
[root @ localhost ~] # chown: guanli / guanli
   / guanli / directory is a group zonghe set zonghe9
[root @ localhost ~] # chown: zonghe / guanli / Zonghe
   / guanli / is a group jishu directory is set to j2
[root @ localhost ~] # chown: j2 / guanli / jishu
15, to establish a public directory / ceshi
   allow all users to read in the technology group, write, execute the file
   prohibit other users to read, write, execute
[root @ localhost ~] # mkdir / ceshi
[root @ localhost ~] # chmod -R rwx = G / ceshi
[the root @ localhost ~] # the chmod -R & lt O = --- / ceshi
16, Clear jerry user password
[root @ localhost ~] # passwd -d jerry
clear a user's password jerry.
passwd: Successful operation
17, the lock and check the status of the user password cucci
[the root @ localhost ~] # cucci the passwd -l | cucci the passwd -S
(. Password has been set, use SHA512 algorithm) cucci PS 2019-07-30 0 99999 7 -1
18, to modify the user's UID obama 8888
[the root @ localhost ~] # 8888 obama the usermod -u
19, by modifying the passwd command user kylin maximum password age of 60 days
[root @ localhost ~] # passwd -x 60 kylin
adjustment data kylin user password aging.
passwd: Successful operation
20, viewed through id groups finger commands the user handy information
[the root @ localhost ~] # ID handy
UID = 1007 (handy) GID = 1007 (handy) group = 1007 (handy), 2003 (. Journal), 2005 (Guanli [)
[ ~ @ localhost root] # Groups Handy
Handy: Handy. Journal guanli
[root @ localhost ~] # Handy finger
the Login: Handy the Name:
Directory: / Home / Handy Shell: / bin / bash
Never logged in.
No mail.
No Plan.

Guess you like

Origin www.cnblogs.com/laohantui/p/11276028.html