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

Eric F Crist ecrist at secure-computing.net
Thu Feb 21 16:31:04 PST 2008


On Feb 21, 2008, at 1:56 PM, David Ledger wrote:

> At 08:19 -0600 21/2/08, Eric F Crist wrote:
>> 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
>
> I take things a stage further (I use ksh) and install somewhere on  
> my PATH a link called -ksh to /bin/ksh (or wherever it is on that  
> system). I can then have an alias
>  soot='sudo -p "Password: " -H -- -ksh -o vi'
> When the shell starts, it sees the leading '-' of its ARGV[0] and  
> becomes a login shell, sourcing all the normal login shell stuff.


Hrm, I don't understand why you've got to go to all that work.  I get  
my _entire_ environment with my method.  It may have something to do  
with my using my favorite shell as my login shell.  Any system I've  
tried it on, I get my full environment.  If you omit the -, you'll  
avoid overwriting your current environment variables, if I remember  
correctly.

I have a custom .vimrc, .cshrc and my config in ~/.ssh, all are  
correctly sourced when I sudo csh as I previously indicated.
-----
Eric F Crist
Secure Computing Networks




More information about the X-Unix mailing list