The difference between using Su and using SU when switching users in a shell

Source: Internet
Author: User
Tags switches

In the shell, if you need to switch users, and then run some commands as a specified user,

For example, you need to write a line of "Oracle_base=/oracle/app" to a. bash_profile file with an ORACLE user.

You can use the following statement

Su-oracle <<!

echo "Oracle_base=/oracle/app" >> bash_profile

Exit

!

About Su and Su-the difference between

Switching users can be implemented using SU Tom or Su-tom, but there is a difference

Su just switches identities, but the shell environment is still the original user's shell

Su-is the user's shell environment with the switch

The environment variable for path is valid when the shell environment is switched

Give examples:

For example, the root user in the/root/directory, Su Tom,

Switch to Tom User, but the directory is still under/root/.

If you use Su-tom

You can find that the directory also switches to Tom User's home directory

This is also caused by a number of command errors: why not Found

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/

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.