The usermod command offers the Linux user the ability to edit user accounts or lock out a user as well as changing the users login shell. Here I am editing the comment about the user “hoshi”.
adeptus-mechanicus ~ # usermod -c "New user" hoshi |
This command parameter changes the login name of user “hoshi”.
adeptus-mechanicus ~ # usermod -l star hoshi |
This parameter will lock the user account so that the user can not login.
adeptus-mechanicus ~ # usermod -L star |
And here is how to change the users shell with the usermod command.
adeptus-mechanicus ~ # usermod -s /bin/sh star |
This is how to set a new password for the user using the usermod command.
adeptus-mechanicus ~ # usermod -p password101 star |
Easier to use the passwd command though.
adeptus-mechanicus ~ # passwd star
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully |
And this is a better way to change the users login shell using the chsh command.
adeptus-mechanicus ~ # chsh star Changing the login shell for star Enter the new value, or press ENTER for the default Login Shell [/bin/sh]: /bin/bash |