brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: set PUID=99 and PGID=100 so a container writes files as nobody:users on Unraid

Unraid
~/tips/tip-unraid-docker-puid-pgid-99-100

id nobody

Makes an Unraid container create its files as nobody:users, the owner your shares expect.

If a container creates files on your Unraid shares that you cannot touch from your Mac or PC afterwards, I would look at who owns those files first.

The Unraid docs, on the page about managing and customizing containers, use PUID=99 and PGID=100 as the example for environment variables that set the user and group IDs for file permissions. On Unraid, 99 and 100 are normally the nobody user and the users group. The docs do not say that, so confirm it on your own server:

id nobody
ls -ln /mnt/user/appdata/<app>

The first line prints the IDs, and the second shows the numeric owner of what a container created. In the container template, add the two variables as normal variables:

PUID = 99
PGID = 100

The LinuxServer.io docs explain the idea. The variables map the container’s internal user to a user on the host, and without them the processes run as root, so files can end up owned by root. That is an image-level feature, though. Many images read these variables at start-up and others ignore them, so check the page of your image before you rely on it.

Changing the IDs does not fix files that already exist with another owner, so you have to correct those yourself. A recursive chown over the whole appdata folder changes every app in it. Do it per app folder, with the container stopped.

Further reading: Managing & customizing containers (Unraid docs), Understanding PUID and PGID (LinuxServer.io)

More Unraid tips Change the RAID profile of a Unraid BTRFS pool with Balance Replace a disk in a redundant Unraid pool from the Main tab Test every Unraid drive with the DiskSpeed container See the XML behind a VM with the inline XML view in Unraid 7 Choose where a new VM's disk image is created with Unraid's storage override All Unraid tips (77) All topics

Link