You’re using a BSD system, Solaris, or some other Unix variant for which bash isn’t the default shell.
You’re tired of starting bash explicitly all the time, and want to make bash your default shell.
First, make sure bash is installed. Try typing bash –version at a command line. If you get a version, it’s installed:
$ bash --version
GNU bash, version 3.00.16(1)-release (i386-pc-solaris2.10)
Copyright (C) 2004 Free Software Foundation, Inc.
If you don’t see a version number, you may be missing a directory from your path. chsh -l or cat /etc/shells may give you a list of valid shells on some systems.
Otherwise, ask your system administrator where bash is, or if it can be installed. chsh -l provides a list of valid shells on Linux, but opens an editor and allows you to change settings on BSD.
-l is not a valid option to chsh on Mac OS X, but just running chsh will open an editor to allow you to change settings, and chpass -s shell will change your shell.
If bash is installed, use the chsh -s command to change your default shell. For example, chsh -s /bin/bash.
If for any reason that fails try chsh, passwd -e, passwd -l chpass, or usermod -s /usr/bin/bash.
If you still can’t change your shell ask your system administrator, who may need to edit the /etc/passwd file.
On most systems, /etc/ passwd will have lines of the form:
As root, you can just edit the last field of the lines in the password file to the full pathname of whatever shell you choose.
If your system has a vipw command, you should use it to ensure password file consistency.
Some operating systems, notably the BSD Unixes, typically place bash in the /usr partition.
You may want to think twice about changing root’s shell on such systems.
If the system runs into trouble while booting, and you have to work on it before /usr is mounted, you’ve got a real problem: there isn’t a shell for root to use.
Therefore, it’s best to leave the default shell for root unchanged. However, there’s no reason not to make bash the default shell for regular user accounts.
And it goes without saying that it’s bad practice to use the root account unless it’s absolutely necessary. Use your
regular (user) account whenever possible.
With commands like sudo, you should very rarely need a root shell.
If all else fails, you can probably replace your existing login shell with bash using exec, but this is not for the faint of heart.
How can I make bash my login shell?” in the bash FAQ at ftp://ftp.cwru.edu/pub/bash/FAQ.