Menu

UNIX TUTORIALS - Unix - User Administration

Unix - User Administration

ADVERTISEMENTS

Managing Users and Groups:

CommandDescription
useraddAdds accounts to the system.
usermodModifies account attributes.
userdelDeletes accounts from the system.
groupaddAdds groups to the system.
groupmodModifies group attributes.
groupdelRemoves groups from the system.

ADVERTISEMENTS

Create a Group

OptionDescription
-g GIDThe numerical value of the group's ID.
-oThis option permits to add group with non-unique GID
-rThis flag instructs groupadd to add a system account
-f This option causes to just exit with success status if the specified group already exists. With -g, if specified GID already exists, other (unique) GID is chosen
groupnameActaul group name to be created.

ADVERTISEMENTS

Create an Account

OptionDescription
-d homedirSpecifies home directory for the account.
-g groupnameSpecifies a group account for this account.
-mCreates the home directory if it doesn't exist.
-s shellSpecifies the default shell for this account.
-u useridYou can specify a user id for this account.
accountnameActual account name to be created

Create a Group

 groupadd [-g gid [-o]] [-r] [-f] groupname

$ groupadd developers

Modify a Group:

$ groupmod -n new_modified_group_name old_group_name

$ groupmod -n developer developer_2

$ groupmod -g 545 developer

Delete a Group:

$ groupdel developer

Create an Account

useradd -d homedir -g groupname -m -s shell -u userid accountname

$ useradd -d /home/mcmohd -g developers -s /bin/ksh mcmohd

$ passwd mcmohd20
Changing password for user mcmohd20.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

Modify an Account:

$ usermod -d /home/mcmohd20 -m -l mcmohd mcmohd20

Delete an Account:

$ userdel -r mcmohd20