[colug-432] Prevent SU from changing CWD

Stephen Potter spp at unixsa.net
Wed Mar 9 09:05:13 EST 2011


On 3/9/2011 8:04 AM, Jeff Stebelton wrote:
> On Wed, Mar 9, 2011 at 7:14 AM, Steve VanSlyck <s.vanslyck at spamcop.net 
> <mailto:s.vanslyck at spamcop.net>> wrote:
>
>     Well that was certainly simple enough - one box of assorted items from
>     the food group "chocolate" for you!
>
>     On Wed, 2011-03-09 at 07:11 -0500, Angelo McComis wrote:
>     > Leave off the -   The - means to emulate logging in, including cwd ~
>     > and loading the environment.
>     >
>     >
>     > - Angelo
>     >
>
> -- 
>
> Note that if you do that, you'll need to provide absolute paths to 
> every command you run, as your PATH variable won't be set..

No, your path won't be changed from what it is as your individual user.  
It's only for commands not in your path, such as if you don't have /sbin:

> [spp at torchwood bocworldgames.com]$ echo $PATH
> /usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/lib/alliance/bin:/usr/libexec/sdcc:/home/spp/bin
> You have mail in /var/spool/mail/spp
> [spp at torchwood bocworldgames.com]$ su -
> Password:
> [root at torchwood ~]# echo $PATH
> /usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/lib/alliance/bin:/usr/libexec/sdcc:/root/bin
> [root at torchwood ~]# logout
> [spp at torchwood bocworldgames.com]$ su
> Password:
> [root at torchwood bocworldgames.com]# echo $PATH
> /usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/lib/alliance/bin:/usr/libexec/sdcc:/home/spp/bin:/usr/lib/alliance/bin:/usr/libexec/sdcc

-spp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20110309/28723f58/attachment.html 


More information about the colug-432 mailing list