[sllug-members]: Environment/Path help
Justin Findlay
justin at jfindlay.us
Tue Dec 12 13:16:56 MST 2006
On AD 2006 December 12 Tuesday 09:52:21 AM -0800, weales at xmission.com wrote:
> Ok, I've been using *nix for over six years (and I feel like a total
> n00b for asking this question), but I need to know how to "source" my
> root user environment variables ($PATH) after I su.
>
> I ssh into systems as a non-root user and then su.
> How can I easily "source" my root environment?
Everyone's going to say
$ su - !!!1@!1
But really the `-` is a kind of shorthand for `-l`, which has the same
effect as `su --login`. The `--login` is analogous to logging in brand
new as another user, but in this case you're not logging in but rather
only switching users with the effect of logging in as that user. In the
tradition of Unix simplicity, one simple command for one simple job,
etc. su doesn't load the new user's env per default because that
involves sourcing their ~/.bash*whatever* files which is more than the
simple operation of 'switching users'. It is also kind of analogous to
rlogin and rsh which you would guess give you, respectively, a login on
a remote host or a remote shell, which these days probably means the
same thing.
Justin
More information about the sllug-members
mailing list