Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to change my default shell in RHEL5 from zsh to bash. I tried to the methods mentioned in this thead. By typing sudo /usr/bin/chsh -s /bin/bash, the system says sudo: /usr/bin/chsh: command not found. But the /usr/bin/chsh is there. Another way I found is to edit /etc/passwd file with my usrid, but it forbids me from editing it. Any suggestions?

share|improve this question
    
Why are you running it as root? You should be able to change your own shell with just chsh. –  FatalError Feb 6 '12 at 20:19
add comment

2 Answers

Maybe your default shell is already bash.

To know your default shell on Red Hat:

finger youruser

output:

Login: XXXXXXXX                         Name: XXXXXX XXXXXX
Directory: /Home/XXXXXX                 Shell: /bin/zsh
Office: XXXXXX
Office Phone: XXXXXXXXXX                Home Phone: XXXXXXXXXX
...

If the Shell information is not /bin/bash then use ypchfn:

$ ypchsh
Changing NIS account information for XXXX on XXXXXXXXX.
Please enter password:

Changing login shell for XXXX on XXXXXXXXX.
To accept the default, simply press return. To use the
system's default shell, type the word "none".
Login shell [/bin/zsh]: /bin/bash

The login shell has been changed on XXXXXXXXX.

Check again your default shell:

finger youruser

output:

Login: XXXXXXXX                         Name: XXXXXX XXXXXX
Directory: /Home/XXXXXX                 Shell: /bin/bash
Office: XXXXXX
Office Phone: XXXXXXXXXX                Home Phone: XXXXXXXXXX
...

Let me know if it is OK for you... Cheers

share|improve this answer
add comment

Make sure /usr/bin/chsh has execute permissions by running sudo chmod a+x /usr/bin/chsh.


You should be able to run chsh using your own account. Otherwise you'd be setting root's shell. Try the following:

chsh -s $( which bash )
share|improve this answer
    
yes, the problem was due to execute permission of chsh. Now, I got a new error when I execute "chsh -s bash", it says "setpwnam: Permission denied. Shell NOT changed. Try again later." –  user268451 Feb 6 '12 at 20:39
1  
@user268451 You can specify for which account to set the shell, e.g. like the following: sudo chsh -s $( which bash) danielbeck (danielbeck of course is the user name) –  Daniel Beck Feb 6 '12 at 20:44
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.