How to change user's shell?

QuestionsQuestions4 SkillsProBasic Files OperationsSep, 12 2025
0136

To change a user's shell in Linux, you can use the usermod command with the -s option. Here’s how to do it:

  1. Open a terminal.

  2. Run the following command, replacing /path/to/new/shell with the desired shell (e.g., /bin/bash) and username with the actual username:

    sudo usermod -s /path/to/new/shell username
    
  3. To verify the change, you can check the user's entry in the /etc/passwd file with the following command:

    sudo grep -w 'username' /etc/passwd
    

You should see the new shell listed at the end of the user's entry.

0 Comments

no data
Be the first to share your comment!