Lesson 6 User Management Essentials
Lesson 6 User Management Essentials
Command Description
useradd Adds a new user account.
userdel Deletes an user account.
usermod Modifies an user account.
groupadd Adds a new group.
groupmod Modifies an existing group
(for example, changes the
GID or name).
groupdel Deletes a group
useradd Command
The useradd command adds new user to the system. Command also
includes various parameters related to the user.
Syntax:
▪ $useradd [-c comment] [-d dir] [-e expire] [-g group] \ [ -G group [ ,
group...]] [ -m ] [-u uid ] \ [-s shell] <loginname>
The login parameter must be a unique string.
Username cannot comprise ALL or default keywords.
▪ Example: $useradd myuser
▪ Example: $useradd -u 3000 -g other -d /home/bcalkins -m -s /bin/sh \ -
c "Bill Calkins, ext. 2345" bcalkins
useradd Command Options
Option Description
-g <gid> Specifies a predefined GID or name for the user that will be the user's primary group.
-G <gid> Defines the new user's secondary group memberships. You can enter multiple groups, but they must be
separated by commas.
-s <shell> Defines the full pathname for the shell program to be used as the user's login shell. The default is /bin/bash if
a shell is not specified.
-c <comment> Specifies the user's full name, location, and phone number, in a comment.
-e <expiration> Sets an expiration date on the user account. Specifies the date on which the user can no longer log in and
access the account. After the specified date, the account is locked. Use the following format to specify the
date: mm/dd/yy.