Who series commands in Linux who/whoami/who am I

Source: Internet
Author: User

In Linux, the WHO series commands exist who/whoami/who am I.

First of all, I have an ordinary user guixian001 system. Then execute the command whoami/who am i/who to execute the command separately. As follows:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6C/B9/wKioL1VRZYrjh8jCAACd9ikK2sU994.jpg "title=" Qq20150512102223.jpg "alt=" Wkiol1vrzyrjh8jcaacd9ikk2su994.jpg "/>

We then use the SU command to switch to the root user and execute the above three commands.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6C/B9/wKioL1VRZjujNeOxAACn1pFaJTU347.jpg "title=" Qq20150512102553.jpg "alt=" Wkiol1vrzjujneoxaacn1pfajtu347.jpg "/>

Do you see the difference? Use the WhoAmI command to display the user name of the current action user. The Who am I displays the user name of "logged in user". To explain this phenomenon, you need to introduce two concepts in Linux-the actual user (UID, the user ID) and the active user (Euid, the effective user ID).

The actual user is the user logged in with the user, so throughout the logon session, the actual user will not change. the active user is the user who is currently performing the operation, which can be switched arbitrarily using the SU and sudo commands. In general, the actual user and the effective user is the same, only when the user identity switch occurs, the difference occurs. So who am I shows the actual user's username, that is, the user ID when logged in, the equivalent of Who-m, and WhoAmI shows the valid user 's ID is euid.

References:

"Linux is the One"

"Who am I"-linux command five-minute series 16

Who series commands in Linux who/whoami/who am I

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.