1. Create / guanli directory, create two directories zonghe and jishu (a command) in / guanli
Create a directory: mkdir + catalog
[root @ localhost chen] # mkdir / guanli / Zonghe / guanli / -p. Journal2, add a group account zonghe, caiwu, jishu, GID numbers are set to 2001, 2002
Create a group account: groupadd + group account name -g + GID GID number setting group accounts
[root@localhost chen]# groupadd zonghe -g 2001[root@localhost chen]# groupadd caiwu -g 2002
[root@localhost chen]# groupadd jishu -g 2003
3. Create jerry, kylin, tsengia, obama user, which kylin user account expire after 30 December 2020
Create a user: useradd + username to modify user attributes: usermod (Option) [parameters] To modify a user name
[root@localhost chen]# useradd jerry[root@localhost chen]# useradd tsengia
[root@localhost chen]# useradd kylin
[root@localhost chen]# useradd obama
[root@localhost chen]# usermod -e 2020-12-30 kylin
4, adding jerry, kylin, tsengia, obama other users into groups zonghe
Add Remove group members: gpasswd
[root@localhost chen]# gpasswd -M tsengia,obama,kylin,jerry zonghezonghe:x:2001:tsengia,obama,kylin,jerry
5, create a handy, cucci users, cucci account login Shell is set to "/ sbin / nologin"
[root@localhost chen]# useradd handy[root@localhost chen]# useradd -d /sbin/nologin cucci
6, adding handy, cucci other users into groups jishu
[root@localhost chen]# gpasswd -M handy,cucci jishu7, all users are required to be added to the aforementioned group within guanli
[root@localhost chen]# groupadd guanli[root@localhost chen]# gpasswd -M handy,cucci,tsengia,obama,kylin,jerry guanli
8, obama users in zonghe group deleted
[root @ localhost chen] # gpasswd -d obama Zongheis the user "obama" delete from "zonghe" group
9, set a password for the user jerry is "123456" (using conventional methods) to set a password "RedHat" (using the method --stdin) to users cucci
[root @ localhost chen] # passwd jerrychange a 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.
[root @ localhost chen] # 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
[Chen the root @ localhost] # the usermod -L Jerry[Chen the root @ localhost] # the passwd -S Jerry
Jerry 2019-07-30 LK -1 0 99999. 7 (password is locked.)
11, two xshell open windows, by (who or w) command to check the connection status, and wherein through a fuser kill
[chen@localhost ~]$ w10:11:22 up 1:48, 4 users, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
chen :0 :0 08:24 ?xdm? 1:13 0.45s /usr/libexec/gnome-session-binary --sessi
chen pts/0 :0 08:24 1:46m 0.15s 0.79s /usr/libexec/gnome-terminal-server
chen pts/1 192.168.100.182 08:25 58.00s 0.55s 0.43s sshd: chen [priv]
chen pts/2 192.168.100.182 10:11 2.00s 0.08s 0.02s w
[root@localhost chen]# fuser -k /dev/pts/2
/dev/pts/2: 4508
12, see cucci users belong to those groups, and to view its details
[root@localhost chen]# id cucciuid=1008(cucci) gid=1008(cucci) 组=1008(cucci),2003(jishu),2006(guanli)
* 13, manually create an account student (reserved)
14, set permissions and ownership: / guanli directory is a group set guanli, is a group / guanli / zonghe directory to zonghe
[root @ localhost chen] # chown: Zonghe / guanli / Zonghe /
[root @ localhost chen] # chown:. Journal / guanli /. Journal /
[root @ localhost chen] # chmod -R 770 / guanli / // recursively modify the permissions and directory guanli directory or file directory , prohibit other users from accessing
[root @ localhost chen] # LS - LD / Guanli [/
drwxrwx. 4 --- 33 is the root Guanli [09:38 July 30 / Guanli [/.
[Chen the root @ localhost] # LL / Guanli [/
total amount of 0
drwxrwx --- 2. 6. Journal July 30, the root 09: . Journal 38
drwxrwx ---. 2 root Zonghe 6 7 Yue 30 09:38 zonghe
14, set permissions and ownership: / guanli directory is a group set guanli, is a group / guanli / zonghe directory to zonghe
is a group / guanli / jishu directory to jishu, set up three directories are prohibited other users to access competence
Set file or directory permissions: chmod settings file ownership: chown
[root @ localhost chen] # chown: guanli / guanli // is a group set up to catalog guanli for guanli[root @ localhost chen] # chown: Zonghe / guanli / Zonghe /
[root @ localhost chen] # chown:. Journal / guanli /. Journal /
[root @ localhost chen] # chmod -R 770 / guanli / // recursively modify the permissions and directory guanli directory or file directory , prohibit other users from accessing
[root @ localhost chen] # LS - LD / Guanli [/
drwxrwx. 4 --- 33 is the root Guanli [09:38 July 30 / Guanli [/.
[Chen the root @ localhost] # LL / Guanli [/
total amount of 0
drwxrwx --- 2. 6. Journal July 30, the root 09: . Journal 38
drwxrwx ---. 2 root Zonghe 6 7 Yue 30 09:38 zonghe
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
[root @ localhost chen] # mkdir / ceshi[root @ localhost chen] # chown:. Journal / ceshi /
[root @ localhost chen] # chmod 770 / ceshi /
[root @ localhost chen] # LS -ld / ceshi /
drwxrwx- -. 2 root jishu 6 7 Yue 30 12:06 / ceshi /
16, clear the user password jerry
[root @ localhost chen] # passwd -d Jerryclear a user's password jerry.
passwd: Successful operation
17, locking the user's password and view the status cucci
[root @ localhost chen] # passwd -d Jerryclear a user's password jerry.
passwd: Successful Operation
[Chen the root @ localhost] # the passwd -S CUCCI
CUCCI LK 2019-07-30 99999 0 -1. 7 (password is locked.)
18, the user's UID is modified obama 8888
[root@localhost chen]# usermod -u 8888 obama[root@localhost chen]# id obama
uid=8888(obama) gid=1006(obama) 组=1006(obama),2006(guanli)
19, kylin modify the user's password by using the passwd command a maximum period of 60 days
[root @ localhost chen] # passwd -x 60 Kylinadjust the user's password aging data kylin.
passwd: Successful Operation
[Chen the root @ localhost] # CAT / etc / Shadow
Kylin: !!: 18107: 0: 60: 18626 ::. 7:
20, see the user id groups and other handy information command
[root @ localhost chen] # the above mentioned id Handyuid = 1007 (Handy) gid = 1007 (Handy) groups = 1007 (Handy), 2003 (. Journal), 2006 (guanli)
[root @ localhost chen] # Groups Handy
Handy: Handy. Journal guanli