Although I learned to arrange with & even like the (t)
csh(1) & it's
funny syntax, I'm tempted to follow
Zirias' &
olli@'s suggetion and try the
shells/zsh with and log into the
toor account more frequently.
Personally I recommend to not log into the root or toor accounts at all. The only time I actually log into the root account is when I have to use single-user mode because something went wrong during an update. And single-user mode uses /bin/sh by default (it ignores the shell entry in the passwd record).
For normal administrative work, I use
su -m
(actually I have an alias
su="su -m"
). Then you will get a root shell that uses the same shell as your normal user account. That is, when your normal user shell is zsh, then
su -m
will give you zsh as the root shell.
However, if you do it like that, you have to be careful with your shell profiles, because the root shell will be executed from your user home directory, and it will process your normal user shell profiles. You probably want to set up a few things differently, depending on whether your shell is started as normal user vs. as root. For example, this is a simplified snippet from my
~/.zshrc:
Code:
if (( EUID == 0 )); then
export MAIL=/var/mail/root
export HISTFILE=/root/.zsh.history
export LESSHISTFILE=/root/.lesshst
alias ls='ls -abG'
umask 022
else
export MAIL=/var/mail/$LOGNAME
export HISTFILE=$HOME/.zsh.history
export LESSHISTFILE=$HOME/.lesshst
alias ls='ls -bG'
umask 077
fi
If you prefer to use
/root as the home directory for your root shells, and also use zsh shell profiles from there, but still want to use
su -m
, then put the following snippet at the beginning of your
~/.zshenv:
Code:
if (( EUID == 0 )); then
export HOME=/root
export ZDOTDIR=/root
if [[ -f $ZDOTDIR/.zshenv ]]; then
source $ZDOTDIR/.zshenv
fi
return
fi
Just for the record, these are the various profiles used by zsh (I have this as a comment at the top of my files):
Code:
# ~/.zshenv EVERY zsh
# ~/.zprofile LOGIN shell only
# ~/.zshrc INTERACTIVE shell only
# ~/.zlogin LOGIN shell only
# ~/.zlogout LOGIN shell only (upon exit)
The vast majority of my personal settings (aliases, functions, key bindings, completion etc.) is in
~/.zshrc so I have it for every interactive shell, whether it’s a login shell or not.
Sorry, I think I've digressed quite a bit …