[X-Unix] sudo -s behavior changed in 10.5?

Eric F Crist ecrist at secure-computing.net
Thu Feb 21 06:19:49 PST 2008


On Feb 21, 2008, at 8:03 AM, Phillip Burk wrote:

> This should probably be filed under the "stupid questions" section  
> of the list but I've noticed that the behavior of sudo changed from  
> 10.4 to 10.5.  I can start a root shell session in Tiger via sudo -s  
> and get all of the custom aliases and the custom prompt via /etc/ 
> bashrc.  But in Leopard a sudo -s command resets the environment,  
> i.e., there are no custom aliases and a generic default prompt.  Not  
> exactly conducive for my productivity as I'm rolling out more and  
> more 10.5 clients into our client base.  For the record, I'm aware  
> that sudo -i will keep the environment as it did in Tiger but the  
> working directory isn't maintained, it's changed to the root home.   
> That's a PITA as well.  I just want the old behavior back and I  
> don't know how to get it.
>
> Things I've tried (lump-headed as they may have been):
>
> 1.  Adding ~/.profile to /var/root.
> 2.  Editing /etc/sudoers (it has changed from 10.4, I thought that  
> perhaps the env_reset default option was doing it)
> 3.  Editing /etc/profile as well as /etc/bashrc (I know, no lectures  
> here, I'm desperate).
> 4.  Endless amounts of googling.
>
> Any advice?  Thanks.

What's always worked for me is to sudo <favorite_shell_here>.  In my  
case, I use csh, so I get my environment and everything with:

% sudo csh

HTH

-----
Eric F Crist
Secure Computing Networks




More information about the X-Unix mailing list