๐ฉ๐พโ๐ป 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
- 2. User and Group Management
- 3. Project Directory & Permissions
- 4. ACLs for Fine-Grained Access
- 5. Archiving and Compression
- 6. Schedule Daily Archival with Cron
- 7. Manage Services and Background Processes
- 8. Check Storage and Memory
- 9. Use Help and Documentation
- Final Tips
๐ง 1. System Initialization & Host Configuration
hostnamectl set-hostname devsrv01
Sets the system hostname.
timedatectl set-timezone America/Chicago
Sets system timezone.
systemctl get-default
systemctl set-default multi-user.target
Checks and sets the default systemd boot target. multi-user.target
is equivalent to runlevel 3 (non-GUI, multi-user mode).
๐ฅ 2. User and Group Management
groupadd devteam
Creates a group named devteam
.
useradd -m -G devteam alice
useradd -m -G devteam bob
Creates users alice
and bob
with home directories and adds them to devteam
group.
passwd alice
passwd bob
Sets or updates user passwords.
๐ 3. Project Directory & Permissions
mkdir -p /devproj/docs
Creates the project directory and a subdirectory docs
.
chown root:devteam /devproj
chmod 2775 /devproj
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
Applies the Sticky Bit so only file owners can delete their own files.
๐ง 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
Adds read/write permission for Bob and read-only for Alice on notes.txt
.
getfacl /devproj/notes.txt
Displays the ACLs applied.
๐ฆ 5. Archiving and Compression
mkdir /backups
tar -czvf /backups/devproj.tar.gz /devproj
Creates a compressed archive (.tar.gz
) of /devproj
into /backups
.
-
-c
: create archive -
-z
: use gzip -
-v
: verbose output -
-f
: filename
tar -xzvf /backups/devproj.tar.gz -C /tmp
Extracts the archive into /tmp
.
โฑ๏ธ 6. Schedule Daily Archival with Cron
crontab -e
Opens the crontab editor.
Example cron entry:
0 0 * * * /usr/bin/tar -czf /backups/devproj_logs_$(date +\%F).tar.gz /devproj/docs
Runs a gzip backup of /devproj/docs
every day at midnight.
I added the second
cronjob
to run every minute for testing. Be sure to enable and start thecron
service.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 toroot:root
. You may resolve this by updating the permissions or create the cronjobs asroot
. I chose to create the cronjobs asroot
.
โ๏ธ 7. Manage Services and Background Processes
systemctl enable sshd
systemctl start sshd
systemctl status sshd
Enables, starts, and checks the status of the SSH service.
echo -e '#!/bin/bash\nwhile true; do echo "Running..."; sleep 10; done' > loop.sh
chmod +x loop.sh
./loop.sh &
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
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
ps aux
shows all processes. pkill
terminates the process.
๐พ 8. Check Storage and Memory
df -h
Shows disk usage in human-readable format.
du -sh /devproj
Shows the size of /devproj
directory.
free -m
Displays memory usage in megabytes.
๐ 9. Use Help and Documentation
man chmod
tldr tar
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 (>
) wheresudo 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
This scenario attempts to reflect real-world scenarios and can be repeated in a VM or lab environment.
Top comments (0)