Linux login shells sh vs bash and how to fix

You just created a new user account on your ubuntu droplet on Digital Ocean using the command:

useradd -g <primary-group> <username>

and logged in the new user account via SSH and it just doesn’t look quite right. You are greeted with a command prompt like this:


not the typical


Attempts to use expected list alias ll fails so you attempt to source the .profile or .bashrc files and get an error stating that source isn’t recognised.

Not only that but the up and down keys don’t reveal your command history and the tab key actually tabs the cursor rather than auto completing.

What’s going on?

Chances are that the system created your user account with /bin/sh as the login shell rather than /bin/bash.

I only know this because it happened to me and I couldn’t figure out what was going on.  I’m reasonably proficient at navigating my way around a Linux system but I’m far from an expert, so after some Googling around I found the following question and response with the command to set the login shell to bash:

sudo chsh -s /bin/bash <username>

Preventing it from happening in the first place

It turns out that it’s possible to prevent this from happening again by using the following command

adduser -g <primary-group> <username>

It sets up a more complete user environment including things like a default .profile and .bashrc – as well as setting the login shell to ‘bash’.

I hope this is of some use to you – and if you want more tips and hints like this then let me know in the comments.

Alex Adams

Alex has been designing, developing and managing software projects since 1998. He is a multidisciplinary developer and has worked with a number of languages, technologies and frameworks. When he's not developing, he's a busy husband and dad who finds a bit of time to train for triathlon events.

Click Here to Leave a Comment Below