Shell – How to Change from csh to bash as Default Shell

shell

I have csh as my default shell, as shown by echo $SHELL. I want to switch to bash as my default shell. I tried the following approaches to no avail:

  1. With chsh I get:

    chsh: can only change local entries; use ypchsh instead.
    
  2. With ypchsh I get:

    ypchsh: yppasswdd not running on NIS master host ("dcsun2").
    

I only have .chsrc in my home directory and I cannot find any .profile files in /etc. How can I change my default shell to bash?

Best Answer

  1. Make sure you've got bash installed.

  2. Learn the location of bash:

    which bash
    

    or

    whereis bash
    

    Below, I'll assume the location is /bin/bash.

    a) If you have administrative rights, just run as root:

    usermod -s /bin/bash YOUR_USERNAME
    

    (replacing YOUR_USERNAME with your user name).

    b) If you don't have adm. rights, you can still just run bash --login at login, by putting the below line at the end of your .cshrc or .profile (in your home directory) :

    setenv SHELL /bin/bash
    exec /bin/bash --login
    
Related Question