|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (1 bit)
Join Date: Mar 2003
Posts: 1
|
su and su -
Hi
Is there any differance between su and su - I was told there was back along but trying to see if there actually is Thanks all |
|
|
|
|
|
#2 |
|
Premium Member
Join Date: Jun 1999
Posts: 9,231
|
There is a difference.
the '-' option will pass the environment unchanged. su statica will allow you to log in as statica, but use your old environment su - statica will log you in as statica and process login scripts etc and change the environment as if 'statica' had originally logged in. |
|
|
|
|
|
#3 |
|
Member (9 bit)
Join Date: Jan 2002
Location: UK
Posts: 389
|
I see,
So for chaging to root account would this have a great deal of differance if its only use of a terminal in another users session |
|
|
|
|
|
#4 |
|
Member (8 bit)
Join Date: Mar 2002
Location: An ancient aircraft hangar.
Posts: 185
|
If you are switching to the root user, then generally it is because you need to do something as the root (all-powerful!) user. In most cases, you would want the root user to have its own path and variable environment rather than the non-root user's environment -- it will usually be just easier that way. There can be valid exceptions, but you just need to think your way through what you need to do, first.
When I'm logged on as my normal user and need to do "some stuff as root", this is what I usually key in at the CL or in a terminal: su - [answer prompt with root user password] I now am root and have root's environment [do "some stuff as root"] [do "some stuff as root"] [do "some stuff as root"] [do "some stuff as root"] exit Now I'm back as my "normal" user with my normal user's environment. The different path environment in each case can be shown by entering: echo $PATH and then you'll see what the path environment is. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|