how do I set 'home' for root

Rick Stevens rstevens at vitalstream.com
Wed Apr 27 20:25:34 UTC 2005


Claude Jones wrote:
> On Wednesday April 27 2005 4:10 pm, Rick Stevens wrote:
> 
>>Claude Jones wrote:
>>
>>>So root is lost - can someone help me tell it how to 'phone home'? I was
>>>wondering why I was getting the strange 'sh-3.00#' prompt in the third
>>>line where I used to get 'root at viewridgeproductions2 ]$'  I think lines 4
>>>and 5 are my clue, but I don't how to fix this, or for that matter, how
>>>it got into this state.
>>
>>"su" only changes the process' effective UID, but doesn't give you
>>root's environment.  "su -" DOES give you root's environment (including
>>root's path and, yes, $HOME).  It's equivalent to logging in as root.
> 
> 
> Assuming I understood you correctly, I tried this:
> sh-3.00# su cj
> [cj at viewridgeproductions2 misc]$ su root
> Password:
> sh-3.00# kcontrol
> Aborting. $HOME is not set.
> sh-3.00#
> 
> I'm getting the same bad result, if I follow you right.

The command is

	su -

(ess-you-blank-dash).  If no username is used after the dash, root is
assumed.  The dash option makes "su" perform the same things that a
login would.  For an example:

	$ su cj

makes your effective UID that of user "cj", but you retain YOUR
environment, current directory, etc., while

	$ su - cj

would make your effective UID that of user "cj" AND give you cj's full
environment.  You're also transferred to cj's home directory (which
is how $HOME gets set anyway).
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-       A squeegee, by any other name, wouldn't sound as funny.      -
----------------------------------------------------------------------




More information about the users mailing list