Free NAS calculators and guides for self-hosting and homelabsFree NAS calculators & guidesTry the RAID & ZFS capacity calculator →

Homelab

How to Find Docker PUID and PGID on a NAS (and Fix Permission Denied)

Find the right PUID and PGID on Synology, Unraid, TrueNAS SCALE, QNAP and UGREEN, learn what PUID=1000 really means, and fix permission denied errors caused by NAS ACLs.

PUID and PGID are the numeric user ID and group ID a container should use when it reads and writes your files. Find them over SSH with id your-username and copy the uid and gid numbers. Typical starting points: Synology 1026/100, Unraid 99/100, TrueNAS SCALE apps 568/568, QNAP a 1000-range UID with group 100. They only work if the image supports PUID/PGID; Docker itself ignores them.

Most “permission denied” problems come from mixing three views: the NAS account name, numeric host ownership and the user running inside the container. This guide shows how to find the right numbers on each NAS platform, then how to fix the cases where matching numbers still is not enough.

Flow diagram of diagnosing Docker PUID and PGID permission problems on a NAS
Fig. 1Flow diagram of diagnosing Docker PUID and PGID permission problems on a NAS

The three identities

  1. Host owner: numeric UID/GID on the NAS filesystem.
  2. Container process user: the UID/GID shown inside the container.
  3. Application convention: variables such as PUID/PGID, USER_ID/GROUP_ID or no variables at all.

Docker itself does not interpret PUID/PGID. The container image's startup script must support them. LinuxServer.io images popularised the convention, and many other images copied it, but not all. Always read the image's official documentation.

What PUID=1000 and PGID=1000 mean

You will see PUID=1000 and PGID=1000 in almost every Compose example online. On desktop Linux distributions such as Ubuntu and Debian, 1000 is the ID given to the first regular user, so on a typical Linux PC it really is “you”. LinuxServer.io's documentation uses 1000 as an example and tells you to run id to find your own values.

On a NAS, 1000 is often wrong. Synology starts manually created users at 1026, Unraid's share owner is 99, and TrueNAS SCALE's apps user is 568. If you paste 1000 without checking, the container writes files as a user that may not exist on the NAS, and your own account or other containers then cannot open them.

How to find your PUID and PGID

On any Linux-based NAS with shell access, these two commands answer the question:

id media
ls -ln /volume1/media

The first command shows the account's numeric UID, its primary group (GID) and other groups. The second shows the numeric owner and group of the folder the container will use. Use the account that should own the data, not necessarily your admin login. A dedicated service account, for example media or docker, limits what a compromised container can reach.

Example output:

uid=1026(media) gid=100(users) groups=100(users)

Here PUID=1026 and PGID=100. The numbers are what matter; the names in brackets are only labels on this NAS.

PUID and PGID on Synology, Unraid, TrueNAS, QNAP and UGREEN

The table gives the values you will usually see. Treat them as a sanity check and confirm them with id on your own system, because IDs depend on the order accounts were created.

PlatformTypical PUIDTypical PGIDWhere the numbers come from
Synology DSM1026 and up100 (users)First manually created user; DSM's built-in accounts use the lower numbers
Unraid99 (nobody)100 (users)Owner of files on user shares; most Community Apps templates default to this
TrueNAS SCALE568 (apps)568 (apps)Built-in apps user and group used by catalog apps and the Apps ACL preset
QNAP QTS / QuTSVaries (often 1000 and up)100 (everyone)Older systems may show 500-range UIDs
UGREEN UGOS ProVariesVaries (admin accounts often show group 10)Check with id; no fixed convention

Synology: find PUID and PGID with SSH

  1. In DSM, open Control Panel → Terminal & SNMP and tick Enable SSH service.
  2. Connect from your computer: ssh your-admin@nas-ip.
  3. Run id for your own account, or id media for a service account.
  4. Note the uid and gid numbers, then turn SSH off again if you do not use it.

A typical first user returns uid=1026(name) gid=100(users). If you prefer not to enable SSH, a one-off Task Scheduler job that runs id and emails the output gives the same answer.

In Container Manager, enter the values as environment variables: in a project, put them in the Compose YAML; when creating a single container in the wizard, add PUID and PGID in the environment section of the advanced settings. A plain ls -l on Synology often shows a + after the permission string. That means ACLs are in charge, which is covered in the Synology ACL section below.

Unraid: why PUID 99 and PGID 100

Unraid does not use multiple Linux users for shares the way a general distribution does. Files on user shares are normally owned by nobody (UID 99) and group users (GID 100), and SMB access is mapped onto that. That is why Unraid container templates pre-fill PUID=99 and PGID=100, and you should usually leave them alone.

If you change a container to 1000 or root, files it creates may not be editable over SMB. The Unraid tool Tools → New Permissions resets shares to the expected ownership, but run it only on the affected share; running it on appdata can break containers that rely on their own internal IDs.

TrueNAS SCALE: the apps user (568)

TrueNAS SCALE ships a built-in apps user and group, both 568. Catalog apps run as 568 by default, and the Apps ACL preset on a dataset grants that group modify access. For a custom app or a Compose file, set PUID=568 and PGID=568 (or the app's “run as” user and group fields) and give the dataset the Apps preset.

To share the same files over SMB, keep your own user as owner or add it to an ACL entry, and leave the 568 entry in place. Editing dataset permissions in the TrueNAS web interface is safer than chmod over SSH, because the GUI manages the ACL type.

QNAP: Container Station and the everyone group

Enable SSH in Control Panel → Network & File Services → Telnet / SSH, connect as an administrator and run id username. The default group is everyone (GID 100). User IDs depend on the firmware generation, so check rather than assume. Avoid using the built-in admin account for containers, because it has full system rights.

UGREEN: UGOS Pro

Enable SSH under Control Panel → Terminal, connect with ssh your-user@nas-ip and run id. Administrator accounts often show gid=10(admin). Using the admin group for a container gives it more reach than it needs, so consider a regular user account for media apps. Disable SSH again afterwards.

Images that use different variable names

Not every image reads PUID and PGID. Setting them on an image that ignores them silently does nothing, which is a common reason values “are not applied”. Examples:

  • LinuxServer.io images (Plex, Jellyfin, Emby, Sonarr, qBittorrent and others): PUID, PGID and often UMASK.
  • Official Emby image (emby/embyserver): UID, GID and GIDLIST; GIDLIST also adds the groups needed for hardware transcoding devices.
  • Official Jellyfin image (jellyfin/jellyfin): the Compose user: field, as used in our Jellyfin Docker setup guide.

To check what an image actually did, run docker exec app id. LinuxServer.io images also print the applied user and group IDs in the first lines of docker logs app.

A Compose example

For an image that explicitly supports PUID/PGID:

services:
  app:
    image: vendor/app:tested-version
    environment:
      PUID: "1026"
      PGID: "100"
      TZ: America/New_York
    volumes:
      - /volume1/docker/app:/config
      - /volume1/media:/media:ro
    restart: unless-stopped

The media mount is read-only because this hypothetical app only needs playback. Docker documentation notes that bind mounts are writable by default and can modify or delete host files; use :ro whenever writes are unnecessary. If you are new to Compose files and folder layout, start with Docker on a NAS: a beginner's guide.

Fix “permission denied” on Synology bind mounts (ACLs)

A common Synology case: PUID and PGID are correct, yet the container still cannot write. The cause is usually the shared folder's ACL, not the mode bits. DSM shared folders use Windows-style ACLs, and ls -l shows a + at the end of the permission string. Mode bits can even look like d---------+ while DSM users have full access, because the ACL decides.

  1. Check what the ACL allows: sudo synoacltool -get /volume1/media.
  2. In DSM, open Control Panel → Shared Folder, select the folder, choose Edit → Permissions and give the user behind your PUID (or its group) Read/Write, or Read only for libraries.
  3. For a subfolder, use File Station → right-click → Properties → Permission, add the user and tick Apply to this folder, sub-folders and files.
  4. Restart the container and test by creating one file from inside it.

Avoid granting Everyone read/write or stripping ACLs with shell commands as a shortcut. Both work, but they widen access for every account and app, and a later change in DSM can undo shell edits.

Why chmod 777 is the wrong fix

World-writable permissions can hide the identity mismatch while giving every local process broad access. It also fails to explain why upgrades or newly created files break again.

Instead:

  1. Decide which service account/group should own the data.
  2. Give that group only required read/write/execute rights.
  3. Run the container as a compatible UID/GID using the image's supported mechanism.
  4. Verify newly created files inherit usable ownership.

A safe troubleshooting workflow

1. Inspect the running process

docker exec app id
docker inspect app --format '{{json .Config.User}}'

The image may start as root and drop privileges later, so inspect the actual process or a shell launched as the application user when documentation specifies one.

2. Inspect mounts

docker inspect app --format '{{json .Mounts}}'

Confirm the source path exists on the Docker host, the destination is correct and the mount is read-write only when intended. A typo can make Docker create a new empty directory when using -v, which looks like lost data.

3. Test access without changing everything

Try listing the directory and creating one temporary file as the container user. If reads work but writes fail, inspect directory write and execute permissions, ACLs and filesystem read-only state.

4. Check parent directories

The process needs execute/traverse permission on every parent directory. A writable final folder is useless if /volume1/private blocks traversal.

5. Check NAS ACLs

Synology, QNAP and TrueNAS interfaces can manage ACLs beyond chmod. Use the platform's supported permission editor where appropriate; a later GUI change may overwrite manual shell adjustments.

user: vs PUID/PGID

Compose also supports a user field:

services:
  app:
    user: "1026:100"

This asks Docker to run the container process with that identity. It can break images that need root during startup to adjust files or bind privileged ports. PUID/PGID may be safer for images designed around that convention because their entrypoint performs the expected setup.

Do not set both blindly. Follow the image's documented method.

Named volumes vs bind mounts

Docker-managed named volumes reduce dependence on exact NAS paths, but they can be harder to browse and include in platform backup jobs. Bind mounts make data location explicit and easy to back up, but host permissions become your responsibility.

Whichever you use, document where persistent data lives and run a restore test. Recreating a container does not restore its database.

Special cases

  • Rootless Docker: UID mapping can make host ownership look different inside the container.
  • NFS: server-side UID/GID and root-squash behavior apply.
  • SMB-mounted paths: permission semantics may not behave like a local Linux filesystem.
  • SELinux: labels can deny access even when mode bits look correct.
  • Kubernetes: securityContext/runAsUser replaces many Compose patterns.

Security checklist

  • Avoid privileged mode unless the application truly needs it.
  • Mount libraries read-only when the app should not modify them.
  • Do not mount /, /var/run/docker.sock or broad system paths casually.
  • Use separate service accounts for unrelated applications.
  • Back up configuration and databases, not container images.
  • Review permissions after migrations because numeric IDs can change.

For remote administration, use Tailscale on a NAS rather than exposing Docker management ports. For HTTPS application publishing, see Reverse Proxy Explained.

File creation and umask

Matching UID/GID is only part of collaboration. The process umask controls permissions on newly created files. A service may create group-owned files that are not group-writable, breaking another container. Use the image's documented UMASK setting or shared-group strategy, then verify actual output with ls -ln.

Do not blindly set umask 000. Choose the narrowest value that supports the applications sharing the directory. For example, UMASK=002 keeps new files group-writable without making them writable by everyone.

Migration trap: numeric IDs change

When moving to a new NAS, the account named media may receive a different numeric UID. Existing files still store numbers, not names. Record service UIDs/GIDs before migration, then either recreate compatible identities or recursively adjust ownership after a verified backup.

FAQ

How do I find my PUID and PGID? Connect to the NAS over SSH and run id username. The number after uid= is the PUID and the number after gid= is the PGID.

What values should PUID and PGID use? The numeric ID of the intended NAS service account and group, but only when the image documents those variables.

Is PUID=1000 and PGID=1000 correct for my NAS? Only if id returns 1000 for the account that owns your data. It is the first user on Ubuntu or Debian, not on Synology (1026), Unraid (99/100) or TrueNAS SCALE apps (568).

What PUID and PGID should I use on Unraid? Usually 99 and 100, the nobody user and users group that own files on user shares. The templates set these by default.

Why do I still get permission denied on Synology with the right PUID? The shared folder's ACL probably does not include that user. Grant Read/Write in Control Panel → Shared Folder → Edit → Permissions, then restart the container.

Why are my PUID and PGID not applied? The image probably does not support them. Check its documentation for user:, UID/GID or similar, then confirm with docker exec app id.

Why can root inside the container not write? Root-squash, rootless mapping, SELinux, read-only mounts or NAS ACLs can still deny access.

Why is the mounted folder empty? The host path may be wrong, may not exist on the Docker daemon host, or may hide files built into the image at the mount destination.

Should containers share one group? Only when they legitimately share data. Separate applications should not gain broad access merely to simplify troubleshooting.

Can I fix ownership with chown -R? It can be appropriate after confirming the target path and backup, but a mistaken recursive chown can damage unrelated data. Test on a small directory first.

Debug record to keep

For each container, document image/version, process UID/GID, supported identity variables, host source paths, container destinations, read/write mode and backup path. This turns the next permission failure from guesswork into a comparison against known-good state.

Backup permissions as well as files

A file backup may preserve content but lose ACLs, extended attributes or ownership required by the application. Record the restore method supported by the NAS and test it into a temporary path. After restore, compare numeric ownership, ACL entries and the container's ability to start and write—not merely the number of files. For databases, use an application-aware export in addition to volume backup. This turns permissions from undocumented host state into a recoverable part of the service. Repeat the test after a NAS migration or major image change.

Keep the verified ownership and restore result beside the Compose file.

Sources

More Homelab & Home Server guidesFree NAS calculators