Most of the Linux flavors use BASH as default shell. But as per requirements or interest people tend to use other shells. In our case, we saw server had CSH set as default SHELL.
Now, there is a utility called chsh is used for changing your default shell without requiring manual modifications in /etc/passwd
How to use chsh to change your default shell?
First of all look at available shells
cat /etc/shells
# /etc/shells: valid login shells
/bin/csh
/bin/sh
/usr/bin/es
/usr/bin/ksh
/bin/ksh
/usr/bin/rc
/usr/bin/tcsh
/bin/tcsh
/usr/bin/esh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/screen
If you are a super user e.g root, chsh syntax is here;
chsh -s /path/to/shell testuser
Example :
chsh -s /bin/bash david
By default user have privilege to change their shell only using below command.
chsh
Output:
Password:
provide your password and it should prompt next screen as below.
Changing the login shell for david
Enter the new value, or press ENTER for the default
Login Shell [/bin/sh]:
By the way, super user(e.g root) can change shell for any user editing /etc/passwd.
+ comments + 1 comments
i got to learn a lot from you !! thanks for that!!
Post a Comment
I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know. Be sure to check back again , after moderation i do make every effort to reply to your comments .