Practical Lab: Users & Groups Management
#### *Objective:*
This lab focuses on hands-on experience in managing users and groups in a Linux environment. Participants will learn how to create, modify, and delete user accounts and groups, as well as manage permissions and access controls effectively.
#### *Lab Setup:*
**Environment**: A Linux-based operating system (e.g., Ubuntu, Kali Linux) with terminal access.
**Permissions**: Ensure you have sudo privileges to perform user and group management tasks.
Lab Activities:
1. *Creating Users:*
**Task**: Create multiple user accounts for different roles (e.g., `developer`, `analyst`, `admin`).
**Command**:
```bash
sudo adduser developer
sudo adduser analyst
sudo adduser admin
```
**Outcome**: Each user should have their own home directory and a set of default configurations.
2. *Modifying User Accounts:*
**Task**: Change the shell for the `developer` user to `/bin/bash`.
**Command**:
```bash
sudo usermod -s /bin/bash developer
```
**Outcome**: Verify the change with:
```bash
grep developer /etc/passwd
```
3. *Changing Passwords:*
**Task**: Change the password for the `analyst` user.
**Command**:
```bash
sudo passwd analyst
```
**Outcome**: Successfully update the password and log in as the `analyst` user.
4. *Creating Groups:*
**Task**: Create a new group called `developers`.
**Command**:
```bash
sudo addgroup developers
```
**Outcome**: Verify the group creation with:
```bash
getent group developers
```
5. *Adding Users to Groups:*
**Task**: Add the `developer` and `analyst` users to the `developers` group.
**Command**:
```bash
sudo usermod -aG developers developer
sudo usermod -aG developers analyst
```
**Outcome**: Check group membership for each user:
```bash
groups developer
groups analyst
```
6. *Deleting Users and Groups:*
**Task**: Remove the `admin` user and the `developers` group.
**Commands**:
```bash
sudo deluser admin
sudo delgroup developers
```
**Outcome**: Confirm deletion:
```bash
getent passwd admin
getent group developers
```
7. *Managing Permissions:*
**Task**: Create a shared directory and set permissions for the `developers` group.
**Commands**:
```bash
sudo mkdir /opt/shared
sudo chown :developers /opt/shared
sudo chmod 770 /opt/shared
```
**Outcome**: Verify permissions:
```bash
ls -ld /opt/shared
```
Conclusion:
This practical lab provides essential skills for managing users and groups in a Linux environment. By completing these tasks, participants will be equipped to handle user accounts and group permissions effectively, enhancing their system administration capabilities.
Additional Resources:
Linux command line documentation
Online tutorials for user and group management
Linux forums for community support
If you have any questions or need further assistance with any of the lab tasks, feel free to ask!