How to modify user's default shell?

QuestionsQuestions8 SkillsProDec, 16 2025
0108

That's a great question! It's very common to want to change a user's default shell from /bin/sh to something more powerful like /bin/bash or /bin/zsh.

In Linux, you can modify a user's default shell using the usermod command. Specifically, you would use the -s or --shell option followed by the path to the new shell.

Here's how you would change the joker user's default shell to /bin/bash:

sudo usermod -s /bin/bash joker

Let's break this down:

  • sudo: As before, this grants you temporary superuser privileges, which are needed to modify user accounts.
  • usermod: This is the command used to modify an existing user's properties.
  • -s /bin/bash: This option specifies the new default shell path. /bin/bash is a popular and feature-rich shell.
  • joker: This is the username whose shell you want to modify.

After running this command, you can verify the change by checking the /etc/passwd file again, just like you did before:

sudo grep -w 'joker' /etc/passwd

You should now see /bin/bash instead of /bin/sh at the end of the joker user's line.

Would you like to try changing the joker user's shell now?

0 Comments

no data
Be the first to share your comment!