Linux Account and Identity Management (1)

Source: Internet
Author: User
Article Title: Linux Account and Identity Management (1 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Account Management:

An important part of the Administrator's work is "managing accounts! Because you are managing the entire system, and all general user applications must be handled with your assistance! Therefore, you must understand how to manage a website account! When managing Linux host accounts, we must first understand how Linux identifies every user!

User ID and group ID:

In fact, Linux does not directly know your "Account Name". What he knows is actually your "account ID! If you have installed software with tarball, it is not difficult to find the file after decompression, hey? Is the archive owner an unknown number 』? Strange? This is nothing strange, because Linux, to be honest, really only knows the number that represents your identity! The corresponding number and account are recorded in/etc/passwd!

How can I log on to a Linux host?

Now let's talk about how we log on to the Linux host? Actually, it's not hard! When we log on to the host in front of the host or using telnet or ssh, the system displays a login screen asking you to enter your account. At this time, after you enter your account and password, Linux will:

Search for the account in/etc/passwd first? If the account does not exist, the system will read the UID (User ID) and GID (Group ID) corresponding to the account. In addition, the Home Directory and shell settings of this account are also read;

Check the password table again! In this case, Linux will enter/etc/shadow to find the corresponding account and UID, and then check whether the password you just entered matches the password in it?

If everything is OK, go to the Shell control stage ??? /P>

Generally, this is the case. So when you want to log on to your Linux host, the/etc/passwd and/etc/shadow must be read by the system, (This is why many attackers write special accounts to/etc/passwd !) Therefore, if you want to back up the Linux Account, you must back up the two files!

Identify UID, GID, SUID, and SGID:

Remember when we mentioned in the "archive system and archive attributes" article that every archive has the attribute of "Owner and owner group? How does an archive determine its owner and group? Actually, UID and GID are used! Each file has a so-called owner ID and owner group ID, that is, UID and GID. Then, the system uses the/etc/passwd content to name the owner and group of the file, show it as an account! We can make a small experiment. You can use the root identity vi/etc/passwd, and then change the user ID of your normal identity to a random number, then, go to your normal identity directory and check the files owned by the original account. You will find that the owner of the file has changed to a number! Can this be understood?

[Root @ test/root] # vi/etc/passwd

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

Bin: x: 1: 1: bin:/sbin/nologin

Daemon: x: 2: 2: daemon:/sbin/nologin

Adm: x: 3: 4: adm:/var/adm:/sbin/nologin

Test: x: 500: 500: test user:/home/test:/bin/bash <= change 500 to 510.

[Root @ test/root] # cd/home/test

[Root @ test] # ll

-Rw-r -- 1 500 test 12542 Apr 12 test

As shown above, it turns into a number ~

After learning about it, please go back to/etc/passwd and change the number back!

Know the/etc/passwd file and/etc/shadow file:

You probably already know from the above descriptions, hey! The two most important files for account management are "/etc/passwd and/etc/shadow! These two archives are one of the most important archives in Linux! If you don't have these two files, haha! You cannot log on to Linux!

Passwd structure:

The structure of this file is as follows: each row represents an account, and several lines represent several accounts in your system! However, you should pay special attention to the fact that many accounts are required in the system (such as bin, daemon, adm, and nobody). Please do not kill him at will ??;

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

Bin: x: 1: 1: bin:/sbin/nologin

Daemon: x: 2: 2: daemon:/sbin/nologin

Adm: x: 3: 4: adm:/var/adm:/sbin/nologin

The above are the preset accounts of manrake 9.0. These accounts are used by the system! Let's take a look at the root system administrator line. You can clearly see that each line is separated by a comma (:), with a total of seven hits, respectively.

Account name: the account name! Corresponding UID! For example, root is the default account name of the system administrator;

Password: the password of the early Unix system is stored in this file, but as a result, it is easy to cause data theft, so I changed the data to/etc/shadow. I will wait for a while and here you will see an x! Don't worry that the password has been moved to the shadow encrypted file ??? /P>

UID: What is the user ID )?? Zookeeper Linux has several restrictions on UID:

0 System Administrator, so when you want to be another System Administrator account, you can change the UID of this account to 0;

1 ~ 500 the ID reserved for the system. In fact, 1 ~ There are no different accounts between 65534, that is, there are no different UID except 0. It is just a habit to set a default account of less than 500 as a reserved account. The advantage is that, taking named as an example, the default owner of this program named UID is 25, when other accounts are also 25, it may cause minor system problems! To prevent this problem, we recommend that you keep the UID before 500 to the system!

500 ~ 65535 for general users!

Can I understand the above instructions? Yes, when the UID is 0, it is root! So please pay special attention to your/etc/passwd file!

[1] [2] [3] [4] Next page

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.