Difference between su and su-in CentOS command line

Source: Internet
Author: User
The su command is used to switch to another user identity. If "user" is ignored when su is used to switch identities, the system switches to the "root" identity by default and requires a password. When switching from the root user to another user, you do not need to enter the password. Otherwise, you need to enter the password of the corresponding user. If the-or-l or -- login parameter is added to a new user, the current Shell environment is switched to the new user's Shell environment, which is equivalent to logging on to the new user from the console. Experiment: use su and su to switch user identities. 1)

The su command is used to switch to another user identity.

If "user" is ignored when su is used to switch identities, the system switches to the "root" identity by default and requires a password. When switching from the root user to another user, you do not need to enter the password. Otherwise, you need to enter the password of the corresponding user.

If the-or-l or -- login parameter is added to a new user, the current Shell environment is switched to the new user's Shell environment, which is equivalent to logging on to the new user from the console.


Lab:

Use su and su to switch user identities.

1) view the current directory with pwd: The Directory of the new user is not displayed when su switches to the new user.

Su-switch to the new user and display the Directory of the new user.

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.