The usermod command modifies the system account files to reflect
the changes that are specified on the command line.
User Modification Commands :
#usermod -c <Add comment> - To change the comment for user.
#usermod -d <Home directory> - To change the user home directory.
#usermod -u <UID> - To change the user id.
#usermod -g <Initial group> - To change initial group.
#usermod -G <Supplementary group> - To add sub group.
#usermod -l <Login name > - To change the login name.
#usermod -s <shell> - To change the shell.
#usermod -L <User name> - To lock the user account.
#usermod -U <User name> - To unlock the user account.
SYNTAX
To Add the Comment Entry
To change the user ID
To change the group ID
To add users to a supplementary group
To change the user's login name
To change a user's shell
Alternate way of changing a shell is by giving command in prompt as chsh
To lock user's password
To unlock a user's password
To delete a user [This will not remove the user's home directory]
To delete a user including home directory
User Modification Commands :
#usermod -c <Add comment> - To change the comment for user.
#usermod -d <Home directory> - To change the user home directory.
#usermod -u <UID> - To change the user id.
#usermod -g <Initial group> - To change initial group.
#usermod -G <Supplementary group> - To add sub group.
#usermod -l <Login name > - To change the login name.
#usermod -s <shell> - To change the shell.
#usermod -L <User name> - To lock the user account.
#usermod -U <User name> - To unlock the user account.
SYNTAX
To Add the Comment Entry
root@linuxstorages:~#usermod -c <Comment> <User name>To change the home directory
root@linuxstorages:~#usermod -d <Home Directory> <User name>
To change the user ID
root@linuxstorages:~#usermod -u <New UID> <User name>
To change the group ID
root@linuxstorages:~#usermod -g <Existing GID> <User name>
To add users to a supplementary group
root@linuxstorages:~#usermod -G ls2 ls3 [Adding user ls3 to group ls2]
root@linuxstorages:~#usermod -G ls2 ls1 [Adding user ls1 to group ls2]
To change the user's login name
root@linuxstorages:~#usermod -l <New Login name> <User name>
To change a user's shell
root@linuxstorages:~#usermod -S /sbin/nologin <User name>
Alternate way of changing a shell is by giving command in prompt as chsh
root@linuxstorages:~#chsh <User name>
To lock user's password
root@linuxstorages:~#usermod -L <User name>
To unlock a user's password
root@linuxstorages:~#usermod -U <User name>
To delete a user [This will not remove the user's home directory]
root@linuxstorages:~#userdel <User name>
To delete a user including home directory
root@linuxstorages:~#userdel -r <User name>
0 comments :
Post a Comment