Always Keep root shell as part of base OS

Most people keep bash as their preferred shell program in FreeBSD. The problem with bash is that it does not come as part of the default FreeBSD package – it has to be installed as a third party application either using pkg_add or by compiling it from ports.

chsh -s /usr/local/bin/bash

If for some reason your ports tree has corruption or the bash port or a supporting port has not been updated properly, you might get locked out from the system the next time you try to log in. The problem would be that root uses bash for login and bash is not working in the ports so you can’t get in.

The way around such a case is to log in to single user mode and set the root shell back to something like sh or tcsh.

To prevent such a thing from happening in the first case, always keep the root shell as something which is not dependent on third party libraries. If you must keep bash then link it statically from ports by specifying WITH_STATIC_BASH during building.

My own preference is install bash but keep csh as the root shell. Once I have logged in to root, I manually run bash and then continue using bash.

Be the first to comment

Leave a Reply

Your email address will not be published.