User and Group manipulation in Linux


  •  -c comment: Add a comment for the user
  • -d home-directory: Create a new home-directory
  • -e yyyy-mm-dd: Date for the account to be disabled
  • -f days: Number of days after the password expires until the account is disabled. (If 0 is specified, the account is disabled immediately after the password expires. If -1 is specified, the account is not be disabled after the password expires.)
  • -g group-name: Primary Group name or group number for the user’s default group (group name must exist)
  • -G group-list: List of secondary additional (other than default) group names or group numbers, separated by commas, of which the user is a member (group name must exist)
  • -m: Create the home directory
  • -M: Do not create the home directory
  • -s: User’s login shell (default /bin/bash)


change or set user password.


Add group


-a, –append
Add the user to the supplementary group(s). Use only with the -G option.

-G, –groups GROUP1[,GROUP2,…[,GROUPN]]]
A list of supplementary groups which the user is also a member of. Each group is separated from the
next by a comma, with no intervening whitespace. The groups are subject to the same restrictions as the group given with the -g option.
If the user is currently a member of a group which is not listed, the user will be removed from the group. This behaviour can be changed via the -a option, which appends the user to the current supplementary group list.

-g, –gid GROUP
The group name or number of the user’s new initial login group. The group must exist.
Any file from the user’s home directory owned by the previous primary group of the user will be owned by this new group.
The group ownership of files outside of the user’s home directory must be fixed manually.




Leave a Reply

Your email address will not be published. Required fields are marked *