December 1, 2015

Changing the default shell in Linux (More specifically, Debian)

It always happens to me that after I install a new server I create my non-root user and I cannot remember the command to change the default shell of my user.

So, just as a self reminder, the command to change the default shell is chsh -s

Example:

chsh -s /bin/bash
The second, and more aggressive option is to change the default shell for further user creations by changing the default config file. For this we have to modify the /etc/default/useradd file by changing the SHELL variable with the shell we want to be default, for example:
... SHELL=/bin/bash ...

References: