View the third field of the root account in the first line of the configuration file/etc/shadow

Source: Internet
Author: User

1. Look at the number in the third field (delimited by ': ') of the root account in the first line of the configuration file/etc/shadow, please figure out how this number came from?

A: The third field of the shadow file indicates the date the password was last modified, the number of days from January 1, 1970, the January 1, 1970 to 1, and then a few days to add. For the meaning of each field in the/etc/shadow file, refer to

http://www.cnblogs.com/zhousir1991/archive/2011/07/25/2116520.html .

2. Write a password that you think is tough.

Answer: LCY$&5JH%@*BGSN

3. Check the information to understand the difference between/sbin/nologin and/bin/false, do you know what occasion they use?

A: These two shells have the ability to prohibit the user from logging in, if the user starts the shell is set to one cannot log on to the system. But/bin/false is relatively stricter, prohibits all services, sets the user's shell to/bin/false, the user cannot log on, and does not have any prompts. While/usr/sbin/nologin is relatively polite, setting the user's shell to/usr/sbin/nologin will politely display a message to the user and deny the user login: This account is currently not available. /usr/sbin/nologin can be used on the FTP service, without users logging on but still providing FTP services.

4. Think about how many files will be modified when we create a new account?

Answer: User password file:/etc/passwd

Encrypted password file:/etc/shadow

User group file:/etc/group

User group password file:/etc/gshadow

5. If we have created a normal user User1, the default user's home directory for/home/user1, do experimental proof can directly modify the/etc/passwd configuration file User1 home directory that field and change User1 home directory? (Hint: You can use the "CD ~" command to enter the current user home directory to verify the method)

Answer: [[email protected] ~]# Useradd user1

[Email protected] ~]# Su-user1

[Email protected] ~]$ CD ~

[Email protected] ~]$ pwd

/home/user1

[Email protected] ~]$ Logout

[Email protected] ~]# Mkdir/tmp/rachy

[Email protected] ~]# VI/ETC/PASSWD

Modify the User1 configuration line in the passwd file/home/user1 to/tmp/rachy, save exit

[Email protected] ~]# Su-user1

-bash-4.1$ CD ~

-bash-4.1$ pwd

/tmp/rachy

-bash-4.1$ Logout

[Email protected] ~]#

As you can see, modifying the passwd configuration file directly modifies the user's home directory.

6./etc/passwd file with ":" As a delimiter, what does the third and fourth fields mean? What happens if I change the third field in a row to ' 0 '?

A: The third and fourth fields represent the user ID and the group ID, respectively, and if you change the third field of a row to 0, the user becomes the root user. For the meaning of each field in the/etc/passwd file, refer to

http://os.51cto.com/art/201003/187533.htm .

7. Add a new group GROUP11, and then add an account user12, so that the account belongs to the group is just new.

Answer: [[email protected] ~]# Groupadd GROUP11

[Email protected] ~]# Tail-2/etc/group

USER1:X:500:

group11:x:501:

[Email protected] ~]# useradd-g group11 user12

[[email protected] ~]# ID user12

uid=501 (User12) gid=501 (GROUP11) group =501 (GROUP11)

[Email protected] ~]#

8. If you delete a group The Times is wrong: "Cannot remove the primary group of user ' aming '" What does this mean? How to solve the problem?

Answer: Delete user group error stating that the user group is non-empty, you can first delete or move the user in the other group as needed, and then delete the empty group.

9. How do I delete an account with the home directory of the account?

A: Userdel-r username is deleted using the-R option together with the home directory.

10. If your Linux does not have a command "MKPASSWD", which package do you need to install?

A: You need to install the expect package and install it using the command Yum install-y expect.

11. Can I change my password for a normal account?

A: Yes, you need to enter your own old password for authentication, validation can be modified through.

12. What does it mean when you use SU with '-' appended to it?

A: Su user1 only switches to user user1, does not switch environment variables, is still the root user's environment variable, su-user1 switches to the user User1, and switches to the user User1 environment variables.

What is the role of sudo?

A: To allow ordinary users to temporarily have root user rights, often used to execute certain commands, do not need to know the root password, just need to know their own password, improve security.

14. When creating the system account, what is the account name to conform to?

A: can be uppercase and lowercase letters, numbers, minus signs (not appearing in the first place), dots, and underscores, other characters are illegal. Although the user name can appear in the point, but not recommended, especially the first point, the other minus is also not recommended, because it is easy to cause confusion.

In the Linux system, do you know how big the maximum UID can be? What is the minimum UID for creating a normal account by default?

A: The maximum uid for a normal user is 65535, and the current Linux core (version 2.6.x) can support up to 4294967295 (2^32-1). The default normal account has a minimum UID of 500.

16. Consider if a user can belong to more than one user group at a time? If so, how do you add a user to another group? How do I join multiple groups at once?

A: A user can belong to more than one group at a time, using the-G option to specify the group to join, and adding multiple groups can use the command usermod-g GRP1,GRP2,GRP3 username.


View the third field of the root account in the first line of the configuration file/etc/shadow

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.