To change the default shell for a user in a Unix/Linux system, you can use the chsh command or the usermod command. Here’s how to do it using both methods:
Using chsh Command
-
Open a terminal.
-
Run the following command, replacing
usernamewith the actual username and/bin/bashwith the desired shell:chsh -s /bin/bash username -
You may need to log out and log back in for the changes to take effect.
Using usermod Command
-
Open a terminal.
-
Run the following command with
sudo, replacingusernamewith the actual username and/bin/bashwith the desired shell:sudo usermod -s /bin/bash username -
Verify the change by checking the
/etc/passwdfile:grep username /etc/passwd
You should see the new shell listed at the end of the user's entry. If you have any further questions, feel free to ask!
