Amanda-Users

Re: user $PATH problem

2006-04-05 17:05:10
Subject: Re: user $PATH problem
From: Gene Heskett <gene.heskett AT verizon DOT net>
To: amanda-users AT amanda DOT org
Date: Wed, 05 Apr 2006 16:59:51 -0400
On Wednesday 05 April 2006 15:43, Matt Hyclak wrote:
>On Wed, Apr 05, 2006 at 03:27:27PM -0400, Gene Heskett enlightened us:
>> But, from the way I mentally processed the path, and I did in a
>> message to Anne, /etc/profile specifically removes /usr/local/sbin
>> from the path if the user has a non-zero uid.  It did not do that
>> when I had added it to /home/amanda/.bash_profile because I'd thrown
>> some echo $PATH's into /etc/profile just to check, so when it
>> survived the "su - amanda", I was scratching my head.  Does that not
>> reset the root uid first to that of "amanda"?  But I've too sleepy
>> to trace that back for the second time today.
>
>On my system (CentOS 4), /etc/profile doesn't remove */sbin paths. It
> only adds them for UID 0:
>
># Path manipulation
>if [ `id -u` = 0 ]; then
>        pathmunge /sbin
>        pathmunge /usr/sbin
>        pathmunge /usr/local/sbin
>fi
>
>(pathmunge is a fancy way to add things to the path either before or
> after the existing path - consider it equivalent to PATH=$PATH:/sbin)
>
Ahh, I had the impression, obviously wrong, that it was able to strip an 
unwanted path from the users $PATH, and that was what it was doing.  I 
didn't see the == 0 there either, my bad.

Thanks for that clarification.

>One way to solve this would be to create a script in /etc/profiles.d/
> to do:
>
>if [ `id -un` = "amanda" ]; then
> PATH=$PATH:/path/to/amanda/executables
>fi
>
>You could modify that to do anyone in a certain group (disk, backup,
> etc.), or just stick it in .bash_profile :-)
>
>Matt

-- 
Cheers, Gene
People having trouble with vz bouncing email to me should add the word
'online' between the 'verizon', and the dot which bypasses vz's
stupid bounce rules.  I do use spamassassin too. :-)
Yahoo.com and AOL/TW attorneys please note, additions to the above
message by Gene Heskett are:
Copyright 2006 by Maurice Eugene Heskett, all rights reserved.

<Prev in Thread] Current Thread [Next in Thread>