su - PATH

su - PATH

Post by Leslie Mikese » Mon, 02 Sep 1996 04:00:00



How do I get /sbin:/usr/sbin into PATH automatically when using the
su from the shadow password suite?  It is somewhat annoying to
su to root for administration but not having many of the admin
commands in your PATH.  The man page doesn't mention any file
to control this - do I have to hack the source?

Les Mikesell

 
 
 

su - PATH

Post by Jon Mitche » Mon, 02 Sep 1996 04:00:00



>How do I get /sbin:/usr/sbin into PATH automatically when using the
>su from the shadow password suite?  It is somewhat annoying to
>su to root for administration but not having many of the admin
>commands in your PATH.  The man page doesn't mention any file
>to control this - do I have to hack the source?

Try using su - root instead of just su root.  This dash gives you the
environment of the user that you want to become instead of just the uid.

Jon Mitchell

*speaks for himself only*

 
 
 

su - PATH

Post by Leslie Mikese » Mon, 02 Sep 1996 04:00:00





>>How do I get /sbin:/usr/sbin into PATH automatically when using the
>>su from the shadow password suite?  It is somewhat annoying to
>>su to root for administration but not having many of the admin
>>commands in your PATH.  The man page doesn't mention any file
>>to control this - do I have to hack the source?

>Try using su - root instead of just su root.  This dash gives you the
>environment of the user that you want to become instead of just the uid.

Thanks, but that also dumps me in root's home directory which is
seldom where I want to be.

Les Mikesell

 
 
 

su - PATH

Post by Gavan Mor » Tue, 03 Sep 1996 04:00:00




: >
: >>How do I get /sbin:/usr/sbin into PATH automatically when using the
: >>su from the shadow password suite?  It is somewhat annoying to
: >>su to root for administration but not having many of the admin
: >>commands in your PATH.  The man page doesn't mention any file
: >>to control this - do I have to hack the source?
: >
: >Try using su - root instead of just su root.  This dash gives you the
: >environment of the user that you want to become instead of just the uid.
:
: Thanks, but that also dumps me in root's home directory which is
: seldom where I want to be.

   So what?  Just cd back to wherever you are going!  Its hardly a major
task - especially since you were considering hacking the source so a normal
su (without the '-') would automatically give you the path of the account
you had su'ed to!

  Some people are never satisfied!

Gavan
--


 
 
 

su - PATH

Post by Paul Caprio » Tue, 03 Sep 1996 04:00:00



>How do I get /sbin:/usr/sbin into PATH automatically when using the
>su from the shadow password suite?  It is somewhat annoying to
>su to root for administration but not having many of the admin
>commands in your PATH.  The man page doesn't mention any file
>to control this - do I have to hack the source?

Put the following in root's .bashrc file:

export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin

and the following in root's .bash_login file:

source .bashrc

Now, you should get the various sbin's added to your path when you either
login as root, or su to root.

Paul

 
 
 

su - PATH

Post by Leslie Mikese » Tue, 03 Sep 1996 04:00:00







>: >
>: >>How do I get /sbin:/usr/sbin into PATH automatically when using the
>: >>su from the shadow password suite?  It is somewhat annoying to
>: >>su to root for administration but not having many of the admin
>: >>commands in your PATH.  The man page doesn't mention any file
>: >>to control this - do I have to hack the source?
>: >
>: >Try using su - root instead of just su root.  This dash gives you the
>: >environment of the user that you want to become instead of just the uid.
>:
>: Thanks, but that also dumps me in root's home directory which is
>: seldom where I want to be.

>   So what?  Just cd back to wherever you are going!  Its hardly a major
>task - especially since you were considering hacking the source so a normal
>su (without the '-') would automatically give you the path of the account
>you had su'ed to!

Not only is it a major task when you are in some very/long/path/over/some/
nfs/mounts but it is annoying when you forget and admin commands that
call other commands fail because they don't have a reasonable PATH.  Note
that I don't necessarily want root's login environment or the PATH
set by anyone's start-up files.  I just want a reasonable PATH which
I don't get by default after using su.  I wouldn't mind if it left
my existing PATH alone (but I understand why some people think otherwise)
or if it gave me something that included the stock admin commands.

Quote:>  Some people are never satisfied!

Nor should they be with less than reasonable program behaviour.  Especially
when other systems get this right out of the box.   Fortunately, however,

suggested changing the defaults in /etc/login.defs.  Fixing
ENV_SUPATH does the trick.  Now I'm just surprised that the man page
for su didn't mention this file.

Les Mikesell

 
 
 

su - PATH

Post by Jon Mitche » Wed, 04 Sep 1996 04:00:00






>>>How do I get /sbin:/usr/sbin into PATH automatically when using the
>>>su from the shadow password suite?  It is somewhat annoying to
>>>su to root for administration but not having many of the admin
>>>commands in your PATH.  The man page doesn't mention any file
>>>to control this - do I have to hack the source?

>>Try using su - root instead of just su root.  This dash gives you the
>>environment of the user that you want to become instead of just the uid.
>Thanks, but that also dumps me in root's home directory which is
>seldom where I want to be.

Great little command called cd for this.  There are only two options..
keep your environment or get the others environment.  If you really need
your user to have root's environment then put it in the su person's
path.. or make an alias for su that actually set PATH's and then does a
normal su.

HTH

Jon Mitchell