Kortenberg - Advent of Sysadmin 2025 - 12/03
3 minute read •
This is part of Sad Servers’ Advent of Sysadmin 2025 series.
I’m doing each challenge every day and I’m publishing a quick write up for each one every day.
12-03: File permissions issue
Spoiler alert! This gives the solution to the challenge. If you want to do it on your own, stop reading.
Scenario: “Kortenberg”: Can’t touch this!
Level: Easy
Type: Fix
Tags:
Access: Email
Description: Is “All I want for Christmas is you” already everywhere?. A bit unrelated, someone messed up the permissions in this server, the admin user can’t list new directories and can’t write into new files. Fix the issue. NOTE: Besides solving the problem in your current admin shell session, you need to fix it permanently, as in a new login shell for user “admin” (like the one initiated by the scenario checker) should have the problem fixed as well.
Root (sudo) Access: True
Test: The admin user in a separate Bash login session should be able to create a new directory in your /home/admin directory, as well as being able to create a file into this new directory and add text into the new file.
The “Check My Solution” button runs the script /home/admin/agent/check.sh, which you can see and execute.
Time to Solve: 15 minutes.
Just like I started the last one, let’s see what we know just by reading the instructions:
- Permissions are messed up
- The admin user can’t list/create new files/directories
Ok. Let’s poke around. Creating files and folders, we get the wrong permissions:
This is an issue with umask!
We can see the umask of the running process, which is our bash session:
But where is that set?
The /etc/profile file sets the umask to 777, which is no permission at all:
if [; then
for; do
if [; then
fi
done
fi
We need to fix that umask value, at least for the admin user. We could simply call umask <mask>, but that would only work for our current session and not, like it’s explained in the instructions, in a new shell/login for the admin user.
What we can do is change the umask in a file loaded during a login session, like ~/.profile.
But what umask value do we need? The usual default is 022, which gives 644 for files and 755 for directories, according to this umask table
And voilà ! 🚩 A new interactive login shell will load the admin’s profile file and get the right permissions.