Linux account Management (CentOS)

Source: Internet
Author: User

1,/etc/passwd

Very detailed explanation of/etc/passwd http://luzl.iteye.com/blog/564404

VI/ETC/PASSWD, you can see the following information, in the last line you can see the information of the user just added. As follows


root:x:0:0:root:/root:/bin/bash
Bin:x:1:1:bin:/bin:/sbin/nologin
Daemon: X:2:2:daemon:/sbin:/sbin/nologin
Adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/ Nologin
Sync:x:5:0:sync:/sbin:/bin/sync
Shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown

......
Fs:x:500:500:centos:/home/fs:/bin/bash
Git:x:501:501::/home/git:/bin/bash
Xereno:x:1004:1004::/home/xereno:/bin/bash


In this file, each data segment of the user record for each row is separated by ":", and each aspect of the user's attributes is defined separately. The order and meaning of each field are as follows:

Registration Name: Password: User id: Group ID: User name: Home directory: Command interpreter

(1) Registration name (LOGIN_NAME): Used to distinguish between different users. The registration name is unique in the same system. On many systems, the field is limited to a length of 8 characters (letters or numbers), and note that it is usually sensitive to the case of letters in a Linux system. This is not the same as msdos/windows.
(2) password (passwd): The system uses the password to verify the legality of the user. Superuser root or some advanced users can use the system command passwd to change passwords for all users in the system, and regular users can use the passwd command to change their passwords after logging on to the system.
Now the Unix/linux system, passwords are no longer stored directly in the passwd file, usually the password field in the passwd file using an "X" instead, the/etc/shadow as a real password file, for the preservation of data including personal passwords. Of course, shadow files cannot be read by ordinary users, only the superuser is entitled to read them.
In addition, it should be noted that if the first character in the passwd field is "*", then it means that the account is blocked, and the system does not allow the user who owns the account to log in.
(3) User identification number (UID): UID is a numeric value, is the only user identity in the Linux system, used to distinguish between different users. Use the UID field when managing processes and file protection within the system. In a Linux system, both the registration name and the UID can be used to identify the user, but the UID is more important for the system, and it is more convenient for the user to use the registration name. For some specific purposes, there can be multiple users with different registered names, but the same UID, in fact, these users with different registered names are actually the same user.
(4) Group identification Number (GID): This is the default workgroup identity for the current user. Multiple users with similar attributes can be assigned to the same group, each with its own group name and distinguished by its own group identification number. Like the UID, the user's group identification number is also stored in the passwd file. In modern Unix/linux, each user can belong to more than one group at a time. In addition to specifying the base groups for which they belong in the passwd file, the users in a group are indicated in the/etc/group file.
(5) User name (USER_NAME): Contains some information about the user, such as the user's real name, office address, contact telephone, etc. In Linux systems, programs such as mail and finger use this information to identify users of the system.
(6) User home directory (home_directory): This field defines the home directory of the individual user, and when the user logs in, his or her shell will use that directory as the user's working directory. In Unix/linux system, the working directory of Superuser Root is/root, while other individual users have their own working environment under the/home directory, and the system configures their own master directory for each user in this directory. Individual users ' files are placed in their own home directory.
(7) command interpreter (shell): The shell is the name of the program that is run when the user logs on to the system, usually a full path name for a shell program.
such as/bin/bash.


It is important to note that system administrators usually do not need to directly modify the passwd file, Linux provides some account management tools to help the system administrator to create and maintain user accounts.

2. Linux normal users get administrator privileges

Linux general users get administrator privileges http://www.cnblogs.com/likwo/p/3435404.html

(1) method One, modify the user, make it belong to the root group (wheel), modified, you can log in with the Tommy account, and then use the command sudo to get root permissions to operate.

Modify the/etc/sudoers file

#vi/etc/sudoers

Xereno all= (All) all

Add user Xereno to the root group

#usermod-G root Tommy (the effect of this command is to change the owning group of/etc/passwd Xereno to root)

(2) method Two, modify the/etc/passwd file, locate the following line, change the user ID to 0, as follows:

Root:x:0:0:root:/root:/bin/bash

.....

Xereno:x:1004:1004::/home/xereno:/bin/bash

Switch

Root:x:0:0:root:/root:/bin/bash

.....

Xereno:x:0:0::/home/xereno:/bin/bash

Linux account Management (CentOS)

Related Article

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.