Solved [Solved] Change root user shell, but only for interactive

Recently I have been reminded that it's not a good idea to change the root user shell to bash. Until now I have no problems with it, despite knowing it is not ideal. It seems ppp does not start at boot when bash is the root users' shell.

However, I log in to root (using su -) all the time, and I need my bash.

So, is there a way to have root shell stay sh but when I su - i get an interactive bash shell?
 
Re: Change root user shell, but only in interactive mode

You could try adding the following line to the top of /root/.profile:
Code:
{ [ "$0" = '-su' ] ||  [ "$0" = '-sh' ]; } && [ -x "`which bash`" ] && exec bash -l
Kevin Barry
 
Re: Change root user shell, but only in interactive mode

Configure the @toor account with the shell of your choice. And then start using # su - toor instead. :) After all, that's the exact use case the @toor account was created for. You could even create a shell alias to automate that for you.
 
Last edited by a moderator:
[SOLVED] Change root user shell, but only in interactive mod

Thanks for your suggestions! I decided to use @toor instead of @root for interactive sessions. I did wonder what that account was for :OOO .

I have used the following alias, so I can log in faster:

alias root="su - toor"

Marking as solved.
 
Last edited by a moderator:
Back
Top