Modify User in Linux
Use usermod command to modify/update existing user account in Linux.
Syntax:
Example:
Change the default shell of user myuser to /usr/sbin/nologin. Use -s or –shell to update the default shell.
Change Home Directory
Use -d or –home switch to change the current home directory of the user. The new directory will create automatically, but the parent directory of the new home must exist.
You can also use -m or –move-home with the above switch to move the content of the home directory as well.
Lock and Unlock User
Use -L or –lock to lock the specific accounts in the Linux system. Use -U or –unlock to unlock any locked user account under the Linux system.
Change Primary Group
Use -g or –gid to forcefully change the user’s primary group. For example, set “staff” as the primary group for the myuser account.
Adding User to Secondary Group
Use -G or –groups to add a user in multiple secondary groups. For example add myuser to staff, accounts group.
0 Comments
CAN FEEDBACK
Emoji