Users and Groups for Linux

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?
The number of days between January 1, 1970 and the last time the password was changed. For example, the root password date change time is Sunday, September 1, 2013, then the third field of root in profile/etc/shadow is 15949, which is calculated as follows:
15949 = (2013-1970) *365+mod ((2013-1970)/4) + (5*31+2*30+28) +1=15695+10+241+1=15949

2. Write a password that you think is tough.
2zbzhsi4#?fega8

3. Check the information to understand the difference between/sbin/nologin and/bin/false, do you know what occasion they use?
/sbin/nologin not allow account login, but can be used in the FTP account, that is, the FTP account even if the setting of the item can also be logged in via FTP
/bin/false strictly prohibit user login system, prohibit the use of all services

4. Think about how many files will be modified when we create a new account?
/etc/passwd
/etc/shadow
/etc/group
/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)
[Email protected] ~]# Useradd user1
[[email protected] ~]# grep user1/etc/passwd
User1:x:502:503::/home/user1:/bin/bash
[Email protected] ~]# sed-i ' s#/home/user1#/tmp# '/etc/passwd
[[email protected] ~]# grep user1/etc/passwd
User1:x:502:503::/tmp:/bin/bash
[Email protected] ~]# Su-user1
-bash-3.2$ Echo $HOME
/tmp
-bash-3.2$ CD
-bash-3.2$ pwd
/tmp
Prove that you can change the user's home directory by changing the/etc/passwd

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 '?
The third one represents the user ID, the fourth is the group ID, and if the third field is changed to 0, the user becomes root

7. Add a new group GROUP11, and then add an account user12, so that the account belongs to the group is just new.
Groupadd group11; Useradd-g GROUP11 User12

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?
This is because there are users in the deleted group, you need to delete the account in the group, and then delete the group

9. How do I delete an account with the home directory of the account?
Userdel-r username

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


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

12. What does it mean when you use SU with '-' appended to it?
Plus-Indicates that when a user is switched, all user environment variables for that user, such as $home, are used, $BASH

What is the role of sudo?
Using sudo allows the normal account to temporarily have root privileges without knowing the root password, for increased security

14. When creating the system account, what is the account name to conform to?
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?
The average user has a maximum uid of 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?
Can belong to multiple user groups at the same time, usermod-g GROUP1,GROUP2,GROUP3 username

Users and Groups for Linux

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.