108

I have a Ubuntu Server VPS and I want to use /bin/bash/ as my shell. How can I change my shell? I have root access but I don't work as root. So dash is my default shell now.

I have read How do I make Bash my default shell on Ubuntu? and chsh seams to be the preferred way to go. But when I type chsh /bin/bash I get this message: chsh: unknown user /bin/bash

And if I just type /bin/bash the Bash shell seams to work fine. How to change it?

Jonas
  • 26,874
  • 52
  • 105
  • 125

3 Answers3

144

When running as root, you can use chsh to change other users shells. The syntax you want to use it this. You can change your own shell without root rights.

chsh -s /bin/bash username

Dentrasi
  • 11,155
  • 4
  • 27
  • 28
100

To change a shell, use the bare chsh command. This will prompt you for the new shell. You do not have to run anything as root.

Teddy
  • 6,848
  • 4
  • 19
  • 19
  • Ah, that was even better! – Jonas Mar 12 '10 at 20:19
  • 10
    don't forget to log out and log back in to see the change. – floer32 Jul 03 '13 at 12:23
  • 29
    Doesn't work as normal user: $ chsh You may not change the shell for 'user'. – Henning May 01 '14 at 20:00
  • 2
    Works for me. Sounds like your system has been deliberately locked down. – Michael Cole Feb 25 '16 at 21:22
  • 1
    I use ssh, but chsh asks me for password which I don't know. Any way to work around this? – Qwerty Apr 28 '16 at 13:25
  • +1 @Henning I found `chsh -s /bin/bash web` to work, as in the [answer below](https://superuser.com/a/119182/21353) from Dentrasi. I can now use tab file/folder path autocomplete at the terminal with my new non-root user (as this is setup in the`.bashrc` file in the user's home directory, I believe (find it with `ls -al`) – therobyouknow Sep 19 '18 at 11:55
  • @Henning seems to be related to external domain login at my institution. – Josiah Yoder Apr 20 '20 at 19:29
65

You can change your default shell for your user by using the usermod command.

sudo usermod -s <shell> <username>

replace with the name of the shell you want to use (i.e. /bin/bash) and with the username for which you want to change it.

This will set the default shell for the username selected in the /etc/passwd file.

txwikinger
  • 2,667
  • 2
  • 21
  • 17