Go Back   PCMech Forums > Linux Support > Linux OS and Software Assistance

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 03-11-2003, 10:58 AM   #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
BatteryPowered is offline   Reply With Quote
Old 03-11-2003, 11:11 AM   #2
Premium Member
 
Statica's Avatar
 
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.
Statica is offline   Reply With Quote
Old 03-11-2003, 11:22 AM   #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
Battery Powered is offline   Reply With Quote
Old 03-11-2003, 04:48 PM   #4
Member (8 bit)
 
jglen490's Avatar
 
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.
jglen490 is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:10 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2