Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Shell switch what is the difference between su and su when the user executes the following statement

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "what is the difference between su and su in shell switching user execution?" in daily operation, I believe that many people have doubts about the difference between su and su in shell switching user execution. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the question of "what is the difference between su and su in the execution of shell switching users?" Next, please follow the editor to study!

In shell, if you need to switch users, then run some commands as the specified user, for example, you need to write a line of "ORACLE_BASE=/oracle/app" to the .bash _ profile file with the Oracle user.

You can use the following statement

The code is as follows:

Su-oracle .bash _ profile

Exit

!

On the difference between su and su-

Switching users can be achieved using su tom or su-tom, but there is a difference between the two

Su is just switching identities, but the shell environment is still the shell of the original user

Su-switch with the user's shell environment

The environment variable of PATH is valid only when the shell environment is switched.

Examples are as follows:

For example, root users are in the / root/ directory, su tom

Switched to the tom user, but the directory is still under / root/.

If you use su-tom

You can find that the directory has also been switched to the home directory of tom users.

This is also the reason for some command errors: command not found

At this point, the study on "what is the difference between su and su when shell switching users execute the following statements" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report