User Management
This guide covers the basics of managing user accounts and groups in Oreon.
Managing Users and Groups
Oreon Linux uses standard Linux tools for managing user accounts and groups. This allows for fine-grained control over permissions and access.
These commands typically require superuser privileges (use sudo).
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 (often the default behavior).-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:
-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 or GID (Group ID):
sudo groupmod -n <new_groupname> <old_groupname>
sudo groupmod -g <new_gid> <groupname>
Deleting Groups
To delete a group:
sudo groupdel <groupname>
Note: You generally cannot delete the primary group of an existing user.
Checking User and Group Information
To see your own user and group IDs:
id
To see user/group IDs for another user:
id <username>
To list the groups a user belongs to:
groups <username>
If no username is specified, it shows the groups for the current user.
User and group information is stored in files like /etc/passwd, /etc/shadow, /etc/group, and /etc/gshadow. While you can view these files, it's recommended to use the provided command-line tools for modifications.