Add tech_docs/linux/add_user.md

This commit is contained in:
2024-05-11 16:52:30 +00:00
parent 2f2ee7e4fc
commit 58c08c2b4c

View File

@@ -0,0 +1,59 @@
Creating and managing user accounts based on a theme like Greek mythology can be both educational and fun, offering a unique way to interact with your system. Here's a general guide on how to manage such user accounts on a Debian Linux system, including creating a primary mythological user and then cloning it for a secondary user.
### Step 1: Define the Primary Mythological User
1. **Choose a Mythological Name**: Lets use "medusa" as your primary mythological user. Medusa, in Greek mythology, is a well-known Gorgon known for her snake hair and gaze that turns people to stone.
2. **Create the User Account**:
```bash
sudo adduser medusa
```
Follow the prompts to set up the user, including password and other details.
3. **Customize the User Environment**:
- Set a custom shell or environment variables.
- Install and configure tools specific to the user's needs.
- Decorate the user's home directory with theme-based elements like custom prompts or ASCII art in `.bashrc`.
### Step 2: Establish Group Memberships
- **Assign to Relevant Groups**: Determine which groups `medusa` should belong to for appropriate permissions.
```bash
sudo usermod -aG sudo,cdrom,dip,plugdev medusa
```
### Step 3: Clone the User
1. **Create a Secondary User**: Choose another character, for example, "hercules".
```bash
sudo adduser hercules
```
2. **Clone Group Memberships**: Assuming you've set up `medusa` and listed her groups as shown previously:
```bash
sudo usermod -aG $(groups medusa | cut -d: -f2 | tr ' ' ',' | sed 's/^,//') hercules
```
3. **Copy Configurations**:
- If `medusa` has specific configurations in her home directory you want `hercules` to have, copy them and ensure ownership is updated:
```bash
sudo cp -r /home/medusa/custom_folder /home/hercules/
sudo chown -R hercules:hercules /home/hercules/custom_folder
```
### Step 4: Maintain and Update
- **Regularly Update User Settings**: As you introduce new tools or changes, keep both users updated. This could involve adding new aliases, updating paths, or installing software.
- **Security and Permissions**: Regularly review user permissions to ensure they have access to what they need and nothing more. This is crucial for maintaining a secure system.
### Step 5: Engage with the Theme
- **Educational Use**: Use these accounts to learn more about Greek mythology. Perhaps each session with `medusa` could display a random fact about her mythological story.
- **Script Automation**: Create scripts that perform tasks named after the user's mythological characteristics, such as a backup script for `hercules` called `labors.sh`.
### Monitoring and Backup
- **Regular Backups**: Ensure user data is backed up regularly. This is crucial for avoiding data loss.
- **Monitoring Usage**: Monitor how these accounts are used, especially if they have sudo access. Tools like `auditd` can help track user actions.
This approach not only makes your system management more engaging but also helps in educating users about mythology in an interactive way. Each user, like a character, can have tailored environments and permissions that reflect their mythological roles and stories.