Link to home
Start Free TrialLog in
Avatar of Los Angeles1
Los Angeles1

asked on

RHEL 6 su command question

What is the difference between

su tcn

Open in new window


and

su - tcn

Open in new window


I looked up the man page and it states:

Change the effective user id and group id to that of USER.

-, -l, --login

Open in new window


Doesn't "su tcn" change the user id.  Would this command not change the group id without the dash ?
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

There is a difference between userid/groupid and "effective" userid/groupid.

The effective IDs are only changed with "su -", and also the login profile of the target user is only executed with "su -".

wmp
With su you just become that user but home directory will not be changed and it will not read his .bash_profile and .bashrc so env variable set by him will not be available but

With su - it is like you have logged in with that user. home directory will be changed. Path will be set according that user. It will read that users .bash_profile and .bashrc, all custome env variable will be available.
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial