Saturday, May 15, 2010

Setting bash as default shell FreeBSD

SkyHi @ Saturday, May 15, 2010

Q. I am using FreeBSD and I would like to setup bash as default shell?

A. CSH is default shell under FreeBSD. First, make sure bash is installed. Type bash to see if you can execute bash:

$ bash

If you get command not found error. Use pkg_add command to install bash

# pkg_add -r -v bash

Now to setup bash as shell type chsh command.

chsh -s /path/to/shell {user-name}

chsh changes the user login shell. This determines the name of the user's initial login command. A normal user may only change the login shell for her own account, the super user may change the login shell for any account. To setup bash default shell for user vivek, type command:

$ which bash



Now change shell:

$ chsh -s /usr/local/bin/bash vivek



Provide your login password. Verify that shell is changed:

$ grep ^vivek /etc/passwd

You can also edit /etc/passwd file and change shell (you need to login as root user):

# vi /etc/passwd

Last filed is shell





Save and close the file.