Change user's default shell
Reasons
To block or disable normal user logins in Linux using a
nologin
shell.To use a shell wrapper script or program to login user commands before they are sent to a shell for execution.
To meet a user’s demands (wants to use a specific shell), especially those with administrative rights.
Default shells
Ways to change
usermod
utility
usermod
is a utility for modifying a user’s account details, stored in the /etc/passwd
file and the -s
or --shell
option is used to change the user’s login shell.
chsh
utility
chsh
is a command line utility for changing a login shell with the -s
or --shell
option.
/etc/passwd
file
In this method, simply open the /etc/passwd
file using any command line text editor and change the specific users shell.
When done editing, save and close the file.
Last updated