Chapter IV Assignment 2

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

2、添加组帐号zonghe、caiwu、jishu,GID号分别设置为2001、2002、2003
[ root@localhost ~]# groupadd -g 2001 zonghe
[root@localhost ~]# tail -4 /etc/group
zonghe:x:2001:
[root@localhost ~]# groupadd -g 2002 caiwu
[root@localhost ~]# tail /etc/guanli
caiwu:x:2002:
[root@localhost ~]# groupadd -g 2003 jishu
[root@localhost ~]# tail /etc/group
jishu:x:2003:

3. Create jerry, kylin, tsengia, obama user, which kylin user account failure in December 2020 after 30
[root @ localhost ~] # useradd Jerry
[root @ localhost ~] # useradd -e 2020-12-30 kylin
[the root @ localhost ~] # the useradd tsengia
[the root @ localhost ~] # the useradd Obama

4, adding jerry, kylin, tsengia, obama other users into Zonghe group
[the root @ localhost ~] # tail / etc / Group
Tom: X: 1002:
axuan: X: 1003:
Zonghe: X: 2001: Jerry, Kylin , tsengia, obama

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 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 ~] -M # Handy the gpasswd, CUCCI, Jerry, Kylin, tsengia, Obama guanli
[the root @ localhost ~] # tail / etc / Group
. Journal: the X-: 2003: Handy, CUCCI,
Jerry: the X-: 2004:
Kylin: the X-: 1004:
tdenia: the X-: 1005:
obama: the X-: 1006:
tsengia: the X-: 1007:
habdy: the X-: 1008:
CUCCI: the X-: 1009:
Handy: X: 1010:
Guanli [: X: 2005: Handy, CUCCI, Jerry, Kylin, tsengia, Obama

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 user jerry is "123456" (using conventional methods)
   to set a password for the "redhat" (use --stdin method) is cucci user
passwd: successful operation
[root @ localhost ~] # passwd
jerry change 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 ~] # 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: Operation Success
[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
[the root @ localhost ~] # WHO
the root: 2019-07-30 16:08 0 (: 0)
the root PTS / 0 2019-07-30 16:08 (192.168.100.169)
the root PTS / 2019-07-30. 1 19:18 (192.168.100.169)
[the root @ localhost ~] # the fuser -k / dev / PTS / 0
/ dev / pts / 0: 4367 ·
12, see cucci users belong to those groups, and to view its details
[root@localhost ~]# groups cucci
cucci : cucci
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
[ root@localhost ~]# chown :guanli /guanli
[root@localhost ~]# chown :zonghe /guanli/zonghe
[root@localhost ~]# chown :jishu /guanli/jishu
[root@localhost ~]# chmod -R a-r /guanli
[root@localhost ~]# ls -l /guanli
总用量 0
d-wx--x--x. 2 root jishu  6 7月  30 19:27 jishu
d-wx--x--x. 2 root zonghe 6 7月  30 19:27 zonghe
[root@localhost ~]# ll -d /guanli
d-wx--x--x. 4 root guanli 31 7月  30 19:27 /guanli
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 ~]# chown :jishu /ceshi
[root@localhost ~]# chmod 770 /ceshi
[root@localhost ~]# ll -d /ceshi
drwxrwx---. 2 root jishu 6 7月  31 19:34 /ceshi
16, clear the user password jerry
[root @ localhost ~] # passwd
-d jerry clear a user's password jerry.
passwd: Successful operation
17, locking the user's password and view the status cucci
[root @ localhost ~] # passwd
-l cucci locked cucci user's password.
passwd: Successful operation
18, the user's UID is modified obama 8888
[root@localhost ~]# usermod -u 8888 obama
19, kylin modify the user's password by using the passwd command a maximum period of 60 days
[root @ localhost ~] # passwd
-x 60 kylin of the user password aging data kylin.
passwd: Successful operation
20, see the user handy information id groups finger commands
[root@localhost ~]# id handy
uid=1001(handy) gid=1001(handy) 组=1001(handy)
[root@localhost ~]# groups handy
handy : handy
[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/liujiaxuan/p/11278750.html