Selective root shells
On my work systems, the root account can be accessed by three system administrators, including myself. I like zsh (for interactive use) and bash for scripting. The other admins do not share my interest in zsh. So, I place a small piece of code such as the following in root@<host>:~/.bashrc
if [ $( /usr/bin/who am i | /bin/awk '{print $1}' ) = "kevin" ]; then
[[ ! -L ~/.zshrc ]] && /bin/ln -s ~kevin/.zshrc ~/.zshrc
exec /usr/local/bin/zsh -l
fi
Then, in root@<host>:~/.zlogout, I add the following:
if [ $( /usr/bin/who am i | /bin/awk '{print $1}' ) = "kevin" ]; then
[[ -L ~/.zshrc ]] && {
echo "removing .zshrc"
/bin/rm -f ~/.zshrc
}
fi
This enables me to enjoy zsh, without upsetting anyone else. I have root-specific code in my .zshrc to tailor the environment to my liking. It has the added benefit of not affecting console logins (unless I log in as myself from the console, and then su - to root).
Cheers,
Kevin