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:
- Open Terminal.
- Use the
usermodcommand:
Replacesudo usermod -s /path/to/new_shell username/path/to/new_shellwith the path of the desired shell (e.g.,/bin/bash,/bin/zsh) andusernamewith 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
- Verify the change:
You can check if the shell has been changed by looking at the
/etc/passwdfile: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!
