User Management
This guide covers the basics of managing user accounts and groups in Oreon.
Prerequisites
These commands typically require superuser privileges. Use sudo before each command.
User Management
Adding Users
To add a new user:
sudo useradd <username>
This creates the user account but it's initially locked. You need to set a password:
sudo passwd <username>
You will be prompted to enter and confirm the new password.
Common options for useradd:
-m: Create the user's home directory-G <group1>,<group2>: Add the user to supplementary groups-s <shell>: Specify the user's login shell (e.g.,/bin/bash)-c "<Comment/Full Name>": Add a descriptive comment
Example: Add user 'jane' to the 'developers' group with a comment:
sudo useradd -m -G developers -c "Jane Doe" jane
sudo passwd jane
Modifying Users
To modify an existing user account, use usermod. Common options include:
| Option | Description |
|---|---|
-l <new_username> |
Change the username |
-g <primary_group> |
Change the primary group |
-G <group1>,<group2> |
Set the list of supplementary groups (overwrites existing list) |
-aG <group_to_add> |
Add the user to a supplementary group (appends to existing list) |
-s <shell> |
Change the login shell |
-L |
Lock the user account |
-U |
Unlock the user account |
Example: Add user 'john' to the 'testers' group without removing existing groups:
sudo usermod -aG testers john
Deleting Users
To delete a user account:
sudo userdel <username>
To also remove the user's home directory and mail spool:
sudo userdel -r <username>
Group Management
Adding Groups
To create a new group:
sudo groupadd <groupname>
Modifying Groups
To change a group's name:
sudo groupmod -n <new_name> <old_name>
Deleting Groups
To delete a group:
sudo groupdel <groupname>
Important
You cannot delete a group that is the primary group of any user. Change the user's primary group first or delete the user.