UNIX TUTORIALS - Unix - User Administration
Unix - User Administration
ADVERTISEMENTS
Managing Users and Groups:
Command | Description |
---|---|
useradd | Adds accounts to the system. |
usermod | Modifies account attributes. |
userdel | Deletes accounts from the system. |
groupadd | Adds groups to the system. |
groupmod | Modifies group attributes. |
groupdel | Removes groups from the system. |
ADVERTISEMENTS
Create a Group
Option | Description |
---|---|
-g GID | The numerical value of the group's ID. |
-o | This option permits to add group with non-unique GID |
-r | This 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 |
groupname | Actaul group name to be created. |
ADVERTISEMENTS
Create an Account
Option | Description |
---|---|
-d homedir | Specifies home directory for the account. |
-g groupname | Specifies a group account for this account. |
-m | Creates the home directory if it doesn't exist. |
-s shell | Specifies the default shell for this account. |
-u userid | You can specify a user id for this account. |
accountname | Actual account name to be created |
Create a Group
groupadd [-g gid [-o]] [-r] [-f] groupname
$ groupadd developersModify a Group:
$ groupmod -n new_modified_group_name old_group_name
$ groupmod -n developer developer_2
$ groupmod -g 545 developerDelete a Group:
$ groupdel developerCreate 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 mcmohd20Delete an Account:
$ userdel -r mcmohd20