About Linux FAQ

Browse More FAQs:

Setting bash as default shell

Posted by Vivek Gite [Last updated: February 2, 2007]

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
Output:

/usr/local/bin/bash

Now change shell:
$ chsh -s /usr/local/bin/bash vivek
Output:

Password

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
From
vivek:x:1000:1000:vivek,,,:/home/vivek:/bin/sh
To
vivek:x:1000:1000:vivek,,,:/home/vivek:/usr/local/bin/bash

Save and close the file.

E-mail this to a friend      Printable version

Related Other Helpful FAQs:

Discussion on This FAQ

  1. Jose Says:

    Don’t forget to create a .bash_profile page or do what I do (from your home dir):

    ln -s .bashrc .bash_profile

  2. naila Says:

    i downloaded this bashish.tar file and ran configure,make,make install,but in the end it wanted me to instal an interactive utility for chnaging the themes..i was annoyed as i was working in the console..so i deleted it..but i had already applied the exec bash comand and now my prompt is -bash-3.00#… i dont knw how to change it back to naila@root# plz help me

  3. Md. Hasan Mahmud Riyad Says:

    Hello Vivek,
    Really a great Job done by you and your coworkers, All tips and tricks are helpfull. and also good understanding for new users. Thank you again for this knid of open source work

    Regrads
    Riyad, Dhaka, Bangladesh

  4. GregMo Says:

    If I missed something here then please forgive me. The question was how do you setup bash to be the default shell. Did I miss that part, or does the response only tell how to change existing accounts to bash?

    To change the default shell one must edit /etc/adduser.conf. Now, if as in my case, this file isn’t present, then you need to run `adduser -C’ to create the file with the defaults you want.

    Cheers,
    GregMo

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.