0
On a stock CentOS 6.1 installation, if I start in my user shell (tcsh) with all my usual command aliases and do what I normally do (in other versions of Linux, and Mac OS X) to get a root shell,
sudo tcsh
my command aliases are not preserved. This is not the behavior I see with sudo on other operating systems, including older versions of RHEL (from which CentOS is derived). I've tried different variations in CentOS 6.1, such as
sudo -i tcsh
sudo tcsh -m
sudo -i tcsh -m
which by my reading of the sudo and tcsh man pages, should make it behave more like a login shell and presumably do things like interpret my .cshrc file, but nothing has worked. My default shell is /bin/tcsh in /etc/passwd; I've tried switching root's entry in /etc/passwd to also use /bin/tcsh (the default was /bin/bash), but it didn't make any difference.
I guess this behavior could be controlled by something in /etc/sudoers, but my /etc/sudoers is the stock file installed by CentOS 6.1, and comparing it to (e.g.) Mac OS X 10.6's /etc/sudoers file doesn't immediately reveal an obvious setting that would control this particular behavior.
I'm stumped at this point and would appreciate help.
Sorry to take so long to get back to this. I tested the first solution (env_keep) but it did not seem to work on my CentOS system. The second solution did, however. Thanks for this. – mhucka – 2014-01-22T22:36:11.367