Confused as to when to use the dash with su
I am confused. I see some tutorials that show using the dash with su to incorporate the users' path with the root path. That's how I understood it, but when I print them out, it's not the case. It appears the "su -" is the root path with no user paths.
Code:
PLAIN SU PATH |
that dash is a keybord shortcut for this command
Code:
"su -" is root BUT a log in AS!!! root and you are in the root HOME folder ( /root) to install software you build you use "su" NO DASH , because you need to still be in the same folder but to say launch Gedit AS ROOT you will NEED the dash -- try it -- Code:
su Code:
su - this folder IS NOT !!! in the normal users system path but it is in root's so for all the programs in that folder you need to be loged in as root ( use the dash ) |
Thank you I see the difference
|
I ran pwd from both, and I see the difference. I didn't notice before the folder changed.
|
... and of course you can specify any target user if you know their passwd eg
Code:
su - fred Note also that if you are starting from the root acct, the above will not require specifying fred's passwd; useful for starting processes as another user during eg boot. |
I thought the ~/.profile or ~/.bashrc files are not run when su is specified without dash.
|
All times are GMT -5. The time now is 08:49 AM. |