When logging in as root at my server everything works fine, but when I log in as myusername the bash is not working correctly.

The line starts with:


instead of


and all specials keys like the arrow keys, tab keys, etc. won't work.

When I type bin/bash it works again, but I'd like to fix the problem or auto run bin/bash on login. How can I fix this?

5 Answers 5


You just need to change your shell. As that user, run:

$ chsh -s /bin/bash

Then sign out and back in.

After doing this the prompt doesn't look like you want, you'll need to start tweaking your environment's PS1 variable.

  • 2
    This is actually kind of dangerous since the question is asking about the root user. He's likely not using Linux. Root should stay with the default shell since the vendor is probably going to count on it being ksh or whatever else they chose. Instead, the real answer is "you shouldn't be logging in as root anyway".
    – bahamat
    Oct 8, 2012 at 22:22

You need to change your shell. Run the command

chsh -s /bin/bash

then sign in again.

However, not all users have the right to change their own shell. If you use sudo remember to add your username to the chsh command as

sudo chsh <username> -s /bin/bash

otherwise you will change the shell for root inadvertently.

  • Fair point. Extended the answer slightly. May 13, 2014 at 13:00
  • I was very naive to try: sudo chsh -s /bin/bash since my user didn't have permission to change shell. Your answer helped me solve it. Thanks!
    – Edenshaw
    Feb 2, 2018 at 15:08

One possible reason is that the default shell of myusername is not bash.

You can check the shell of your current user with:

  • echo ${SHELL}
  • echo $0

To change the user shell permanently see man chsh , e.g.:

chsh -s /bin/bash

If your sudo user password is disabled, you can edit the /etc/passwd directly, find the line where your user is and change the shell path into /bin/bash.

Here is the explanation of /etc/passwd format.


Just wanted to add one more thing.

If sudo access is required to change the bash for that user, then you need to mention your username as well in the sudo command since without username it will apply to the root user.

$ sudo chsh -s /bin/bash <user>

You must log in to answer this question.