Real and effective IDs

Source: Internet
Author: User

"Real and effective IDs"

At the lowest level of the operating system, the kernel, users and groups aren ' t identified by names, but numbers . The kernel needs to being fast and robust, and data structures better be small, and moving around strings are anything but eff Icient. So, each user name and group name are mapped to a unique unsigned number, called User and group ID for short, or UID and GI D. This mapping are done via the /etc/passwd and /etc/group files, respectively. The user and group ID 0 is commonly called root, but that ' s really just a convention.

Each Unix process have a user ID and a group ID associated with it, and when trying to open a file for writing, for Instanc E, these IDs is used to determine whether the process should is granted access or not. These IDs constitute the effective privilege of the process, because they determine what a process can do and WHA T it cannot. Most of the time, these IDs is referred to as the effective UID and GID.

What happens when do you invoke the passwd utility is, the effective UID of the process is set to 0, i.e. the UI D of the root user. As a result, the program was permitted to modify the /etc/passwd file, and can thus replace the encrypted password In your account entry with the new one just provided.

If you're familiar with the passwd utility, you'll know that as a normal user, and you'll only have allowed to modify the Password of your own account; It won't let you modify the password for any other account. So this begs the question, what does it know who invoked it?

That's where another pair of user and group ID comes in, called the real uid and GID, respectively. These IDs is used to the track who a user really is, i.e. the what account he or she was logged in. This UID value was not changed when you invoke programs such as passwd. So-the program simply needs to find-out-what user name corresponds-to-its real uid, and refuse-to-change all other account .

Reference: http://www.lst.de/~okir/blackhats/node23.html

Real and effective IDs

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.