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

David Ledger dledger at ivdcs.demon.co.uk
Fri Feb 22 00:47:47 PST 2008


At 18:31 -0600 21/2/08, Eric F Crist wrote:
>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.

I suspect my environment is more complex than yours then. I doubt the 
choice of shell makes any difference. I'm surprised .vimrc is 
relevant.

The point of my method is that you _get_ root's environment, and with 
suitable code at the end of root's .profile you can make your own 
additions. Where I'm in charge of a box, I make root's .profile 
source a file (I call it .userprofile) in the home directory of the 
user that called sudo (from $SUDO_USER). I make that file a hard link 
to my .profile which already has sections that get skipped if root. 
Where I'm not in charge of the box, I add a file in root's HOME that 
does the same when '.' sourced. The other admins have always been 
happy with that and some have used it.

David


-- 
David Ledger - Freelance Unix Sysadmin in the UK.
HP-UX specialist of hpUG technical user group (www.hpug.org.uk)
david.ledger at ivdcs.co.uk
www.ivdcs.co.uk


More information about the X-Unix mailing list