- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- su - user2 and su user2
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2002 06:38 AM
04-25-2002 06:38 AM
su - user2 and su user2
In both situation of
user1#> su - user2 and
user1#> su user2
I have following questions:
1) if user1's the environment will be inherited in user2, including .profile, and all environment variables.
2) if user2's environment will be executed.
thanks in advance.
Roger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2002 06:42 AM
04-25-2002 06:42 AM
Re: su - user2 and su user2
it will inherit the environment of user2
but whet U do su user2
the environment will be as defined in the user1 profile.
Sandip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2002 06:46 AM
04-25-2002 06:46 AM
Re: su - user2 and su user2
In the first scenario - Yes
In the second - No.
The "-" forces the env inheritance. Without the "-" user1 retains it's env & just "becomes" user2.
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2002 06:47 AM
04-25-2002 06:47 AM
Re: su - user2 and su user2
b) user1#> su user2
1) if user1's the environment will be inherited in user2, including .profile, and all environment variables.
==> No for a); Yes for b)
2) if user2's environment will be executed.
==> Yes for a); No for b)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2002 11:46 AM
04-25-2002 11:46 AM
Re: su - user2 and su user2
This may be just a matter of semantics, but...
From the "su" man page ( v10.20 ):
... su executes a new shell with the real and effective user ID,
real and effective group ID, and group access list set to that
of the specified user.
The new shell is the one specified in the shell field of the new
user's entry in the password file, /etc/passwd. su uses the Bourne
shell (see sh-bourne(1)).
The arguments (the balance of the command line after username) are
passed along to the new shell for execution, permitting you to run
shell procedures with the new user's privileges.
When you exit from the new shell, the previous user name and
environment are restored.
If you specify the - option of the su command, the new shell starts up
as if you just logged in.
---------------------------------
So, with the "su -" option, there is no "inheritance" going on. You are creating a completely new shell. If, as user1, you assign a value to MYVAR, then "su - user2", the user2 environment will not have a MYVAR environment variable.
HTH,
Tom