1. check the related files in your Linux system and answer the following question: l What is the root user ID and group ID? Where is his home directory? Highlight: ro
1. check the related files of your Linux system and answer the following questions:
L What is the root user ID and group ID? Where is his home directory?
Highlighted: the root user ID is 0, the group ID is 0, and the main directory is/root.
L What is the group name and ID of the root user?
Highlighted: the root group is named root and the group ID is 0.
L I would like to cite a common user to point out his main directory and the shell he uses?
As you can see, gao is a common user. its main directory is/home/gao, and the shell used is bash.
L name a common user and indicate the group name and ID of the user.
As you can see, gao is a common user and its group name is gaogao and its ID is 500.
2. create a user named abc1 (abc represents your name in full, the same below) and add the password "123456" to the user ". View the encrypted ciphertext of the user account and password.
3. create user abc2, set the password to "abcdef", and add it to the group abc2group (if this group does not exist, create it first ).
4. create a user named abc3 and switch from the root user's identity to the user's identity. Then switch from the user identity to the root user.
5. create a user named abc4 and set the password to null to verify whether the setting is successful.
, Failed.
6. create a user named abc5 as the root user, and then lock the user. verify that the user is locked and delete the user as the root user.
7. create a new group abc6group and add users abc1 and abc2 to the group. Finally, check the group of abc1 and abc2 to determine whether the setting is successful.
8. create a new user group named abc7group, create a user named abc7, set the user to belong to the abc7group group, and create files a and B in the/home/abc7 directory as abc7.
9 Add a new user abc8 and set the user's home directory to/home/abc (if this directory does not exist, you must create it yourself). If the password is blank, add the new user group abc8group, specify the GID as 600 (if the system has used this GID, you can choose to set another
GID), and use the abc8group group as the additional Group of the user abc8. Finally, check the basic information of the abc8 user to determine whether the setting is successful.
(10) add a new user abc9, set the user password to "123456", modify the passwd file, and set the user password to be changed within 10 days, and send a warning message to the user three days before the expiration date (note: During the experiment, you can adjust the system time to verify whether it is correct ).
Start another putty client to log on to the jerry9 user. the user has just been created, so there is no expiration warning.
Log on to another client using root and modify the system time
Then, log on to jerry9 and you will find an expired warning message.
(11) select and use the grep command to count the number of common users in the current system.
First, use the command (more/etc/login. defs) to view the range of automatically increasing UIDs of common users in Linux. The UID ranges from 500 to 60000.
Then use the regular expression for filtering.
[Root @ localhost ~] # Grep-E [a-zA-Z_0-9]: [a-z]: \ ([5-9] [0-9] {2} \ | [1-9] [0-9] {3} \ | [1-5] [0- 9] {4 }\| [6] [0] {4 }\): [z-zA-Z_0-9]/etc/passwd
Briefly explain the meaning of the above regular expression
-E: indicates that the Extended RegEx type regular expression is used for matching.
[A-zA-Z_0-9]: [a-z]: a string that matches the front edge of the UID
: [Z-zA-Z_0-9]: represents a string matching the UID
The key is this expression.\ ([5-9] [0-9] {2} \ | [1-9] [0-9] {3} \ | [1-5] [0- 9] {4 }\| [6] [0] {4 }\), it is used to filter the UID between 500 and 60000.
This expression can be split into four sections:
Section 1:[5-9] [0-9] {2}: indicates that the number of hundred digits is 5-9, and the number of digits and a single digit can be any number.
Section 2:[1-9] [0-9] {3}: indicates that the number of thousands is 1-9, and other digits can be any number.
Section 3:[1-5] [0-9] {4}: indicates that the maximum number of digits is 1-5. other digits can be any number.
Section 4:[6] [0] {4}: number 60000
The "\ |" in the middle means "or", and the two ends are parentheses.