Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

It doesn't seem to work for some reason if I do this in /etc/profile:

export SHELL="/bin/bash/"
share|improve this question

3 Answers 3

up vote 4 down vote accepted

The chsh $USER command changes users' shell.

If you want to change them all at once, you can modify the /etc/passwd file.

You don't want a trailing slash when attempting to execute a binary file.

share|improve this answer
2  
Editing the passwd file directly can cause some issues. Use the command vipw -s if you're going to do this. –  3dinfluence Mar 10 '10 at 22:11
1  
You can't pipe sed through vipw. –  Warner Mar 10 '10 at 22:12
2  
Well it's not too hard to replace strings in vim. I wouldn't risk passwd/shadow corruption. –  3dinfluence Mar 10 '10 at 22:14
    
You have a good point, I don't disagree. As a side note, the shadow file doesn't store the shell. =) –  Warner Mar 10 '10 at 22:23

To set the default shell when you create a new user, it depends how you create new users. For useradd in Linux (Ubuntu, at least), edit /etc/default/useradd and change the SHELL variable.

share|improve this answer

I'm not sure if it's universal across Linux distros, but in most Unix implementations the file /etc/shells lists the shells that users can choose from. So if you don't want the users to be able to use chsh to change to something else, make sure bash is the only shell listed there.

share|improve this answer
    
/etc/shells also has other uses; in many ftpd implementations, /etc/shells is consulted to see if the user has a 'valid' shell. (this allows you to set their shell to /bin/false, but add it to /etc/shells, so they can use ftp, but not get a shell.) –  Joe H. Mar 26 '10 at 1:57

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.