How do I switch from an unknown shell to bash?

Assuming the unknown shell supports running an absolute command, you could try: /bin/bash

To change the default shell, I would use chsh(1). Sample usage: chsh -s /bin/bash $USER


You type in bash. If you want this to be a permanent change the default shell to /bin/bash by editing /etc/passwd.

Here's some snippets from my /etc/passwd:

avahi:x:84:84:Avahi daemon:/:/bin/false
xenoterracide:x:1000:100::/home/xenoterracide:/bin/zsh
postgres:x:88:88::/var/lib/postgres:/bin/zsh
bob:x:1001:1001::/home/bob:/bin/bash
usbmux:x:140:140:usbmux user:/:/sbin/nologin

The very last field contains the shell, Modifying the field after the last : to a valid or invalid shell will work. /bin/false and /sbin/nologin both mean the user doesn't have a real login shell, although if pam is not set up right this doesn't mean they can't login (I reported a bug on this in Arch Linux, because you can login graphically without having a login shell). /bin/bash and /bin/zsh are both valid shells, see /etc/shells for a list of valid shells on your systems. Here's my /etc/shells if you're interested.

/bin/sh
/bin/bash
/bin/ksh
/bin/zsh
/bin/dash

Yes you can use chsh or usermod to do the same things, please remember these are just structured text files, and TIMTOWTDI.


If chsh or manually editing the config won't work, but a ~/.profile script is executed at login, add this line:

exec /bin/bash --login

Tags:

Shell