Difference between Su-and Su

Source: Internet
Author: User

Simply use 'su 'to switch to the root identity,The read variable is set to non-login shell. Many original variables will not be changed.To completely switch to the new user's environment, you must use 'Su-username' or 'Su-l username' to use the login-shell method. Will be converted into the environment of new users together with the path/user/mail variables; therefore, the use of Su username may sometimes cause problems, but when some systems enter related commands, will replace some environment variables with your own. However, to ensure command correctness, use Su
-The usrname format is better. If you only want to execute the root command once, you can use 'Su-c "command string;

Example:

1) Use su Root

Root @ Ubuntu:/home/jack # env | grep 'jack'
Orbit_socketdir =/tmp/orbit-Jack
Username = Jack
Pwd =/home/Jack

2) use Su-Root

Root @ Ubuntu :~ # Env | grep Root
User = root
Mail =/var/mail/root
Pwd =/root
Home =/root
LOGNAME = root

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.