The difference between the Linux su and sudo commands, and get root permissions

Source: Internet
Author: User

SU (superuser)

SU is the switch user, such as: input: Su command after the return of the current user to switch to the root user, or: input: su-root (or other user name) here added "-" after the change of the current environment variable to the new user's environment variable.

Su Root (or another user name) indicates that the environment variable is not switched to the current user.

sudo means to get the temporary root command, such as Sudo gedit/etc/shadow, which means to temporarily use root permissions to edit the/etc/shadow password file because the/etc/shadow password file requires root permission to open and edit. This is why the sudo command is used to temporarily use root permissions to do some work that cannot be done on a regular account.

Sudo-i is logged in as root, the actual user ID and valid user ID of the process become root, and the home directory is switched to the root directory.

To get root privileges:

1, sudo su (essentially Su, and Su by default is to get root permissions)

2, Su

3. Su Root

4, Su-root

5, Sudo-i

The difference between the Linux su and sudo commands, and get root permissions

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.