Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing default shell in Linux [closed]

How is it possible to change the default shell? The env command currently says:

SHELL=/bin/tcsh 

and I want to change that to Bash.

like image 278
mahmood Avatar asked Oct 24 '12 09:10

mahmood


People also ask

How do I change the default shell to bash in Linux?

Hold the Ctrl key, click your user account's name in the left pane, and select “Advanced Options.” Click the “Login Shell” dropdown box and select “/bin/bash” to use Bash as your default shell or “/bin/zsh” to use Zsh as your default shell. Click “OK” to save your changes.

Can we change shell in Linux?

Users can change shell to any other shell listed in /etc/shells/. The root account can be used to change any other user login shell. If an account has a restricted login shell, then only the root can change that user's shell.

How do I change my shell temporarily?

You can change your shell temporarily by creating a subshell and using that instead of the original shell. You can create a subshell using any shell available on your Unix system.

Which command can you change the default user shell for an existing user?

Using the -s or --shell option allows you to easily change the default shell for a specified user. Root (or sudo) access is necessary for using the usermod command. NOTE: Using usermod does not change your current shell, it simply sets the default shell to be used the next time you log on.


1 Answers

Try linux command chsh.

The detailed command is chsh -s /bin/bash. It will prompt you to enter your password. Your default login shell is /bin/bash now. You must log out and log back in to see this change.

The following is quoted from man page:

The chsh command changes the user login shell. This determines the name of the users initial login command. A normal user may only change the login shell for her own account, the superuser may change the login shell for any account

This command will change the default login shell permanently.

Note: If your user account is remote such as on Kerberos authentication (e.g. Enterprise RHEL) then you will not be able to use chsh.

like image 167
Summer_More_More_Tea Avatar answered Oct 06 '22 01:10

Summer_More_More_Tea