Files in /ps/tmp owned by root

Thanks for reporting this, @devon!

TL;DR: Please change your docker exec command to run either

docker exec -u node -it photostructure sh

or

docker exec -it photostructure su -p node

These commands are almost equivalent, but the result is the same: you’ll have a terminal running as node, rather than root, whose UID and GID is whatever you’ve configured $PUID and $PGID to be in your container.

Longer background

I’d written the tooling and sync documentation before I’d added support for custom UID/GID–so,
(un)fortunately, that command is operating as (un)expected: docker tells Alpine to spawn a shell, and the default userid is root, so photostructure will be running as root as well.

You need to su to the user within the docker container before you kick off sync.

docker-entrypoint.sh does this su stuff for the initial main daemon, but (I don’t know if I can) prevent root logins from subsequent docker execs. (Docker experts: if there is a way, I’m all ears!)

There’s a bit more going on here, as well: your host computer’s realuser won’t exist within the docker container. Rather than creating a new realuser within the container, the docker-entrypoint.sh changes the existing node user to match the UID of $UID or $PUID. The end result is that you want to run photostructure as node, so replace sh with su -p node (the -p is short for --preserve-environment, and may not be necessary), or tell docker to run the shell as node by using docker exec -u node.

In summary, please use the following for your docker exec command:

sudo docker exec -u node -it photostructure sh

update: I’ll fix the existing documentation, and PhotoStructure v2.1.0-alpha.4 will emit to stderr if there’s a mismatch between $UID, $PUID, $GID, or $PGID and the current effective user id or group id:

$ docker exec -it photostructure sh
# ./photostructure --help

WARNING: current process UID=0 but $PUID=1001.

This may result in file permission issues.
See <https://forum.photostructure.com/t/1597/2> for details.

See also:

2 Likes