How to change user's login shell?

QuestionsQuestions8 SkillsProYour First Linux LabAug, 11 2025
0200

To change a user's login shell in a Unix-like operating system, you can use the usermod command. Here’s how to do it:

Steps to Change User's Login Shell:

  1. Open Terminal.
  2. Use the usermod command:
    sudo usermod -s /path/to/new_shell username
    
    Replace /path/to/new_shell with the path of the desired shell (e.g., /bin/bash, /bin/zsh) and username with the name of the user whose shell you want to change.

Example:

To change the login shell of a user named john to bash, you would run:

sudo usermod -s /bin/bash john
  1. Verify the change: You can check if the shell has been changed by looking at the /etc/passwd file:
    grep john /etc/passwd
    

This command will show you the user's entry, including the new shell at the end.

If you have any further questions or need more assistance, feel free to ask!

0 Comments

no data
Be the first to share your comment!