user $PATH problem

Craig White craigwhite at azapple.com
Wed Apr 5 15:56:36 UTC 2006


On Wed, 2006-04-05 at 10:20 -0400, Gene Heskett wrote:
> Greetings;
> 
> I've been trying to help Anne Wilson setup a working amanda system at 
> her place for over a week now, and having all sorts of troubles that 
> were triggered by the amanda executables not being in the user amanda's 
> environmental path when she actually logs in as amanda, as opposed to 
> doing an 'su amanda' from root, which of course gets you the full 
> maryann of roots $PATH.  Thats why when she sent me an example of the 
> command she was useing, it was always after cd'ing to the amanda src 
> tree and doing "./amcheck" or whatever, otherwise she was getting not 
> found messages.
> 
> This was found by "su - amanda" means here, and its a huge gotcha for 
> the unwary.  Seemingly un-necessary paranoia to me, but...
> 
> When doing it as amanda, with amanda's full $PATH, /usr/local/sbin, 
> where all of amanda's executables live, is NOT in the $PATH.
> 
> Adding it to ~/.bash_profile seems to allow it to survive the 
> pathmunge'ing being done in /etc/profile, so I'm A) confused as to why 
> it does, and B) in any event, is there a good reason to dis-allow 
> access to /usr/local/sbin for the normal user?
> 
> Explain it to me please.
----
not entirely clear what you are asking.

su -
the implications are explained in the info page to su...you need the '-'
to obtain the shell environment (bash_profile, etc.) of the user login.

Not sure why you guys aren't using the rpm packages instead of compiling
from source/tarball - or if you feel you need newer versions, why not
download tarball and make an rpm from the spec file from amanda source.
All of the heavy lifting should be already done for you and these would
be non-issues and updating would be simple.

anyway...normal usage would not allow a user access to /sbin
or /usr/sbin but in checking from rpm package install of amanda
that /var/lib/amanda/.bash_profile looks like below (amanda's home
directory in rpm package install being /var/lib/amanda)...

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
PATH=$PATH:/usr/sbin
BASH_ENV=$HOME/.bashrc
USERNAME="amanda"

export USERNAME BASH_ENV PATH

Which to me means that you should adjust for your different paths of the
amanda routines/binaries in /usr/local/sbin and thus, allow by
necessity, the user amanda access to these files as some of these will
fail if run by root (as I'm sure you know).

Craig




More information about the fedora-list mailing list