112

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?

0

3 Answers 3

102

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.

7
  • Ah, that was even better!
    – Jonas
    Mar 12, 2010 at 20:19
  • 10
    don't forget to log out and log back in to see the change.
    – floer32
    Jul 3, 2013 at 12:23
  • 29
    Doesn't work as normal user: $ chsh You may not change the shell for 'user'.
    – Henning
    May 1, 2014 at 20:00
  • 2
    Works for me. Sounds like your system has been deliberately locked down. Feb 25, 2016 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, 2016 at 13:25
148

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

5
  • 12
    -1 chsh does not need to be run as root to change your own shell. Changing others' shells requires root.
    – Broam
    Mar 12, 2010 at 17:25
  • 3
    This worked. I always get the "You may not change the shell for ..." error message.
    – setzamora
    Jun 18, 2017 at 21:30
  • 2
    Logout and log back in after to observe the change
    – smac89
    Nov 27, 2017 at 9:26
  • 2
    +1 I found this to work, after trying chsh command when logged in as the user and getting "You may not change the shell for ..." Sep 19, 2018 at 11:57
  • @Broam - This absolutely does have to be run as root on some systems. See the above messages.
    – Addison
    Jun 29, 2020 at 23:32
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.

3
  • 11
    Use usermod if you see "chsh You may not change the shell for..."
    – Xeoncross
    Jun 27, 2016 at 23:22
  • 2
    voting up, since chsh didn't work for me indeed. Thanks!
    – Mixaz
    Dec 8, 2016 at 19:46
  • 2
    Important to note that usermod requires sudo
    – ARun32
    Jul 4, 2017 at 22:00

Not the answer you're looking for? Browse other questions tagged .