How to change the default shell?

QuestionsQuestions8 SkillsProUser Account ManagementNov, 02 2025
0105

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

  1. Open a terminal.

  2. Run the following command, replacing username with the actual username and /bin/bash with the desired shell:

    chsh -s /bin/bash username
  3. You may need to log out and log back in for the changes to take effect.

Using usermod Command

  1. Open a terminal.

  2. Run the following command with sudo, replacing username with the actual username and /bin/bash with the desired shell:

    sudo usermod -s /bin/bash username
  3. Verify the change by checking the /etc/passwd file:

    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!

0 Comments

no data
Be the first to share your comment!