Skip to main content

LHB Linux Digest #26.21: Permission Denied Decoded, Container UIDs and Kubernetes Certifications

The file looks fine. Something else says no.

ยท By Abhishek Prakash ยท 5 min read

Warp Terminal

Last week I shared about the 50% off on the official Linux and Kubernetes certifications. 217 people opted for certification exams, mostly CKA and CKNE. Some were ambitious and went for Kubestronaut, the mega Kubernetes certification bundle. Looks like everyone is setting their goals for 2027.

Remember that today is the last day of the offer (it ends at 23:59 UTC). Get the discounted exam today, prepare at your own pace and attempt it twice anytime in the next 12 months. It cannot get any better than this for DevOps career aspirants.

This also tells me something. Many readers are looking to get certified. So, I am planning on creating study materials and even videos focused on these certifications. We already have a Kubernetes course. But that's for learning in general and doesn't guide you towards a CKA exam.

Linux Handbook's goal for 2027: Create certification preparation courses.

๐Ÿงต Permission denied, but the file says yes

You run ls -l, the bits look right, and you still get "Permission denied". The file is rarely the culprit. Go through these in order:

The path: Every directory above the file needs execute (x) permission. One locked parent blocks everything below it. The terminal tip below shows how to find it in one command.

The + at the end: If ls -l shows something like -rw-r-----+, an ACL is attached and the usual bits are not the full story. Run getfacl file to see the extra entries. Watch for the mask line, which can quietly cap what named users and groups actually get (look for #effective:).

Your groups: Just added yourself to a group with usermod -aG? Your current session doesn't know about it yet. id shows the groups your shell has right now, while id $USER shows what the system has on record. Log out and back in, or use newgrp for that shell.

New files with the wrong permissions: That's umask. With the common 022, new files get 644 and directories 755. Shared project directories often need 002 so group members can write.

On Fedora or RHEL? SELinux has its own say. ls -Z shows the label, and sudo ausearch -m avc -ts recent shows what got blocked.

If you need a refresher on the basics, our file permissions guide and the chmod and chown tutorials have you covered.

๐Ÿณ DevOps corner: root inside, nobody outside

Containers add their own twist. The kernel doesn't care about usernames, only numeric IDs. If the app in your container runs as UID 1000 and your bind-mounted directory on the host belongs to UID 1001, you get "Permission denied", even though both are called something friendly on their own side.

You should compare the numbers, not the names:

ls -ln ./data
docker exec mycontainer id

The clean fix is to run the container as a matching user with --user "$(id -u):$(id -g)" (or user: in Docker Compose). Resist chmod -R 777. It makes the error go away and opens everything else.

In Kubernetes, the same idea lives in the pod's securityContext:

spec:
  hostUsers: false
  securityContext:
    runAsUser: 1000
    runAsGroup: 3000
    fsGroup: 2000
    fsGroupChangePolicy: "OnRootMismatch"

runAsUser and runAsGroup set who the processes run as. fsGroup makes mounted volumes group-owned by that GID so the app can write to them. On big volumes, Kubernetes changes ownership recursively at every mount, which slows pod startup, so OnRootMismatch tells it to skip that when the top directory is already right.

hostUsers: false turns on user namespaces, which went GA in Kubernetes 1.36. Root inside the pod maps to an unprivileged UID on the node, so a container escape lands somewhere far less useful.

If you are preparing for CKAD or CKS, securityContext is exam territory. The official docs page is worth a read.

๐Ÿ’ก Quick terminal tip

A file's own permissions can look fine and you still get "Permission denied", because every directory above it also needs execute (x) permission. namei -l lists the owner, group and permissions of each part of the path, so you can spot the directory that's missing it:

namei -l /srv/app/data/file.txt

It comes with util-linux, so it's already installed on most distributions. Symlinks along the path are followed and shown. On SELinux systems, add -Z to see each part's security context too.

๐Ÿ“ฆ Self-hosting: Yamtrack

Yamtrack is a self-hosted media tracker, a single place to keep track of everything you watch, read and play, from movies and TV shows to anime, books and games. It records your progress, scores and history, and it can log what you watch on Jellyfin, Plex or Emby automatically. It complements the media server setup in your homelab.

GitHub - FuzzyGrim/Yamtrack: A self hosted media tracker.
A self hosted media tracker. Contribute to FuzzyGrim/Yamtrack development by creating an account on GitHub.

๐Ÿ› ๏ธ Tool discovery: isd

isd a keyboard-driven terminal UI for managing systemd units, with fuzzy search, previews that refresh on their own, and automatic sudo when a command needs it.

GitHub - kainctl/isd: isd (interactive systemd) โ€“ a better way to work with systemd units
isd (interactive systemd) โ€“ a better way to work with systemd units - kainctl/isd

๐Ÿ˜‚ Geek humor

๐Ÿ’Œ Keep on loving Linux Handbook

Missed the previous editions? You can access the newsletter archives.

And since you are here, please tell me what kind of materials would you like to see more in the newsletter as well as on the web portal? Tutorials, commands, more tools in the newsletter, courses, CTF games and puzzles? Your feedback will guide me to make Linux Handbook useful for you.

I will be waiting for your feedback. Just hit the reply button.

About the author

Abhishek Prakash Abhishek Prakash
Updated on Dec 4, 2026