[Techtalk] su (was :- trying to find a question that _is_ "too dumb")

Hamster hamster at hamsternet.org
Wed Aug 13 12:56:05 EST 2003


Ash,

> At least I finally understand why I have to give a full path to use sbin
> programs when I su to root..  Since the shell doesn't load root's shell
> config files (bash.rc or something like that), the path never gets set,
> does it?  Thanks Kai.  :)

You can solve that problem by running su as follows:
su -

The - means "su to root *and* load roots environment settings".

You see, if youre just logged on as the user, say, Hamster, then sbin isn't
in Hamster's $PATH. If you just su, then you become root, but with Hamster's
environment settings, including her $PATH, which contains no sbin.

However, if you type su -, then it leaves all of Hamster's settings behind
and you become root with root's settings. Including a $PATH that contains
sbin.

Hamster



More information about the Techtalk mailing list