DEV Community

Devon Argent
Devon Argent

Posted on

Day 5: Managing Users, Groups, and Shells in Linux 🐧

Day 5 of my #1HourADayJourney. Today, I moved from file security to Identity Management. If you are managing a database server, you need to know exactly who has access to your system and what level of privileges they hold.

🛠️ Key Commands Practiced

1. The User Lifecycle

Managing users is the first step in system administration. Here is how I handled the user lifecycle:

# Creating a user with a home directory
sudo useradd -m bob

# Setting/Updating the password
sudo passwd joker

# Deleting a user and their home directory
sudo userdel -r bob
Enter fullscreen mode Exit fullscreen mode

2. Modifying User Attributes

Sometimes a user needs a different shell or a specific home directory. I used usermod to reconfigure them:

# Changing the home directory
sudo usermod -d /home/wayne joker

# Changing the login shell (e.g., to bash)
sudo usermod -s /bin/bash joker
Enter fullscreen mode Exit fullscreen mode

3. Privilege Escalation

Not every user should have administrative rights. I practiced adding a user to the sudo group, which grants them the power to execute commands as the root user:

sudo usermod -aG sudo joker
Enter fullscreen mode Exit fullscreen mode

4. The "Hidden" System Files

I learned where Linux keeps its sensitive user data:

/etc/passwd: Stores user information (UID, Home Directory, Shell).

/etc/shadow: Stores password hashes (only accessible by root for security).
Enter fullscreen mode Exit fullscreen mode

Follow my journey: #1HourADayJourney

Top comments (0)