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.

When I ssh as root, my shell is bash, but when it's a non-root user it is sh. How can I make them both to use bash? This actually goes against the logic in this question: Why root's default shell is configured differently with other normal user account's default shell?

share|improve this question

4 Answers 4

up vote 2 down vote accepted

Please see man usermod.

An example would be sudo usermod -s /bin/bash username.

share|improve this answer

You can do this either while creating the user with the option useradd -s /bin/bash, or later with usermod -s /bin/bash as suggested by can, or by modifying the /etc/passwd file as suggested by asoundmove. But if you are looking for another solution, then I suggest looking for the file /etc/default/useradd and modifying it according to your need. If you change the line SHELL=/bin/bash, it will apply to every new user. Also have a look at /etc/login.defs file.

Hope it will help you.

share|improve this answer

The command chsh(1) is used to change a user's shell. The system can be set up to allow only certain shells by listing the allowed shells in /etc/shells. This does not need root privileges, but a user can only change their shell.

You will need to enter your password (not root) to change your shell, unless you are root, in which case no password is needed and you can set any program to be used as a user's shell (ignoring /etc/shells).

share|improve this answer

As far as I know your default shell is defined in /etc/passwd (as decided at user creation). Change /etc/passwd on the target machine to reflect your choice.

share|improve this answer
1  
OMG thanks. I used useradd, so that's why it was configured to sh. If you use adduser, it will be bash on Ubuntu. –  m33lky Apr 17 '11 at 4:39
    
@fortress You can use the -s option to set the shell at user creation time. –  Keith Apr 17 '11 at 7:22

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.