Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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. chsh. I get:

    chsh: can only change local entries; use ypchsh instead.
    
  2. 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?

share|improve this question
3  
It could be useful to know on which type of unix you are. –  enzotib Sep 13 '11 at 15:32
add comment

2 Answers

up vote 6 down vote accepted
  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) :

     SHELL=/bin/bash exec /bin/bash --login
    
share|improve this answer
    
2b. Check if bash is enumerated in /etc/shells with correct path. –  manatwork Sep 13 '11 at 16:37
    
@manatwork That would be relevant for 2a, not 2b. And only useful in a strange/broken system setup for determining why the solution did not work. –  rozcietrzewiacz Sep 13 '11 at 16:46
    
Yes, actually my intention was to write something like "2a.b". –  manatwork Sep 13 '11 at 17:02
    
1. SHELL=/bin/bash gives a command not found error. 2. Your solution gives me a bash shell as the prompt. But it does not change my login shell. Thanks for the help though. –  Sumod Sep 14 '11 at 6:37
    
Here is what I did to resolve this. 1. exec /bin/bash --login in the .cshrc file 2. set SHELL=/bin/bash and then export SHELL in the /etc/profile file. Thanks. –  Sumod Sep 14 '11 at 8:41
show 1 more comment

Contact your system administrator. He's set things up wrong. If you are your system administrator then you've set things up wrong.

The error message looks pretty straight forward. You don't have yppasswd running on dcsun2. It should be.

But doing a quick google search comes up with this result which indicates that you'll get this error if yppasswd is running on both the client and the server. In this case turn it off on the client.


If you're stuck with csh as your login shell, you can still make it invoke bash when you log in. Put the following commands in your ~/.login (see also Changing the default shell without chsh or administrator priviledges):

sleep 2
if (-x /usr/local/bin/bash) then
  exec /usr/local/bin/bash -l
endif

Replace /usr/local/bin/bash by the proper path if necessary. If everything works, remove sleep 2 (which puts a delay during which you can press Ctrl+C to drop to a csh prompt, in case something goes wrong).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.