DEV Community

LaTerral Williams
LaTerral Williams

Posted on

๐Ÿ‘ฉ๐Ÿพโ€๐Ÿ’ป Welcome to devsrv01: Your First Day as a Linux Sysadmin

๐Ÿ‘ฉ๐Ÿพโ€๐Ÿ’ป Youโ€™ve been hired as a junior sysadmin at a mid-sized company running RHEL 9 servers. Youโ€™re assigned to configure, manage, and troubleshoot a new development server called devsrv01.

You have one day to complete the tasks before the system is handed off to the developers.


๐Ÿ“‘ Table of Contents


๐Ÿ”ง 1. System Initialization & Host Configuration

hostnamectl set-hostname devsrv01
Enter fullscreen mode Exit fullscreen mode

Sets the system hostname.

Image description

timedatectl set-timezone America/Chicago
Enter fullscreen mode Exit fullscreen mode

Sets system timezone.

Image description

systemctl get-default
systemctl set-default multi-user.target
Enter fullscreen mode Exit fullscreen mode

Checks and sets the default systemd boot target. multi-user.target is equivalent to runlevel 3 (non-GUI, multi-user mode).

Image description


๐Ÿ‘ฅ 2. User and Group Management

groupadd devteam
Enter fullscreen mode Exit fullscreen mode

Creates a group named devteam.

useradd -m -G devteam alice
useradd -m -G devteam bob
Enter fullscreen mode Exit fullscreen mode

Creates users alice and bob with home directories and adds them to devteam group.

Image description

Image description

passwd alice
passwd bob
Enter fullscreen mode Exit fullscreen mode

Sets or updates user passwords.


๐Ÿ” 3. Project Directory & Permissions

mkdir -p /devproj/docs
Enter fullscreen mode Exit fullscreen mode

Creates the project directory and a subdirectory docs.

chown root:devteam /devproj
chmod 2775 /devproj
Enter fullscreen mode Exit fullscreen mode

Sets ownership to root:devteam, then applies 2775 permission:

  • 2: SGID bit (preserves group ID)
  • 7: Owner read/write/execute
  • 7: Group read/write/execute
  • 5: Others read/execute
chmod +t /devproj/docs
Enter fullscreen mode Exit fullscreen mode

Applies the Sticky Bit so only file owners can delete their own files.

Image description


๐Ÿง 4. ACLs for Fine-Grained Access

touch /devproj/notes.txt
setfacl -m u:bob:rw /devproj/notes.txt
setfacl -m u:alice:r-- /devproj/notes.txt
Enter fullscreen mode Exit fullscreen mode

Adds read/write permission for Bob and read-only for Alice on notes.txt.

getfacl /devproj/notes.txt
Enter fullscreen mode Exit fullscreen mode

Displays the ACLs applied.

Image description


๐Ÿ“ฆ 5. Archiving and Compression

mkdir /backups
tar -czvf /backups/devproj.tar.gz /devproj
Enter fullscreen mode Exit fullscreen mode

Creates a compressed archive (.tar.gz) of /devproj into /backups.

  • -c: create archive
  • -z: use gzip
  • -v: verbose output
  • -f: filename

Image description

tar -xzvf /backups/devproj.tar.gz -C /tmp
Enter fullscreen mode Exit fullscreen mode

Extracts the archive into /tmp.

Image description


โฑ๏ธ 6. Schedule Daily Archival with Cron

crontab -e
Enter fullscreen mode Exit fullscreen mode

Opens the crontab editor.

Example cron entry:

0 0 * * * /usr/bin/tar -czf /backups/devproj_logs_$(date +\%F).tar.gz /devproj/docs
Enter fullscreen mode Exit fullscreen mode

Runs a gzip backup of /devproj/docs every day at midnight.

Image description

I added the second cronjob to run every minute for testing. Be sure to enable and start the cron service.

Image description

Note: I had difficulty getting the cronjob to run. After troubleshooting I discovered the user account I used to create the cronjob did not have permissions to /backups because it belonged to root:root. You may resolve this by updating the permissions or create the cronjobs as root. I chose to create the cronjobs as root.



โš™๏ธ 7. Manage Services and Background Processes

systemctl enable sshd
systemctl start sshd
systemctl status sshd
Enter fullscreen mode Exit fullscreen mode

Enables, starts, and checks the status of the SSH service.

Image description

echo -e '#!/bin/bash\nwhile true; do echo "Running..."; sleep 10; done' > loop.sh
chmod +x loop.sh
./loop.sh &
Enter fullscreen mode Exit fullscreen mode

Creates and runs a simple infinite loop script in the background.

If the previous fails due to permission denied; try the following:

Use sudo tee (Best Practice for Redirection)

echo -e '#!/bin/bash\nwhile true; do echo "Running..."; sleep 10; done' | sudo tee loop.sh > /dev/null
Enter fullscreen mode Exit fullscreen mode
  • tee receives the content from echo and writes it as root.

  • /dev/null prevents duplicate output to your screen.

The above script would still print to screen and did not seem to work as a single line. If you have the same issue try the following:

./loop.sh > /dev/null 2>&1 &


ps aux | grep loop.sh
pkill loop.sh
Enter fullscreen mode Exit fullscreen mode

ps aux shows all processes. pkill terminates the process.

Image description


๐Ÿ’พ 8. Check Storage and Memory

df -h
Enter fullscreen mode Exit fullscreen mode

Shows disk usage in human-readable format.

du -sh /devproj
Enter fullscreen mode Exit fullscreen mode

Shows the size of /devproj directory.

free -m
Enter fullscreen mode Exit fullscreen mode

Displays memory usage in megabytes.

Image description


๐Ÿ“˜ 9. Use Help and Documentation

man chmod
tldr tar
Enter fullscreen mode Exit fullscreen mode

man provides manual pages. tldr shows simplified examples.


Need an assist with tldr? Check out my article on finding command info in Linux: Need Info on a Linux Command?


โœ… Final Tips

  • Use sudo wisely when writing files or starting services; especially with redirection (>) where sudo tee is more reliable.

  • Practice creating users, groups, and directories in /tmp to avoid permission issues.

  • Enable and verify cron jobs:

sudo systemctl enable --now crond
cat /var/log/cron  # Check if jobs ran
Enter fullscreen mode Exit fullscreen mode

This scenario attempts to reflect real-world scenarios and can be repeated in a VM or lab environment.

Top comments (0)