ivandokov / phockup

Media sorting tool to organize photos and videos from your camera in folders by year, month and day.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Moved files can not be deleted

moritzfl opened this issue · comments

This might be docker specific but when files are moved, users may only read the files but not delete it.

I am currently experimenting with Phockup on my Unraid-NAS and the plan is to have two folders where me and my wife can drop in photos and have them organized by date. However, neither me nor my wife can actually modify anything in the moved data (delete/rename does not work).

For Unraid, there is a fix that works but it has to be manually triggered from the User Interface. It would be nice if the Docker image would take care of properly handling permissions instead.

The fix is described here
Essentially an Unraid Plugin repairs permissions in folders that were set by docker containers.

Description from the web interface of the Unraid Plugin:

You should use this tool in case a misconfigured docker application
 (notably CouchPotato or Sonarr / SickBeard) has written media files 
to your array with the wrong permissions, and you find yourself unable
 to modify / delete those files.

This utility starts a background process that goes to each of your data
 disks and cache disk and changes file and directory ownership to 
nobody/users (i.e., uid/gid to 99/100), and sets permissions as follows:


For directories:
  drwxrwxrwx

For read/write files:
  -rw-rw-rw-

For readonly files:
  -r--r--r--

By the way and just in case this is interesting for you - if the configuration options could be accessed through Environment Variables instead of Post Arguments, it would be pretty easy to publish Phockup in the Unraid-Store (as shown in this YouTube video).

I don't use Phockup as docker image and I don't have any idea about this issue so any assistance is more than welcome.

Regarding publishing the software to Unraid app store - this sounds interesting and I think we can adapt the code to honor environment variables. Anyone willing to work on this is welcome to send a PR (or maybe two - one for env vars and one for store config). I hope we can push to the store automatically using our existing Github Actions pipeline.

@moritzfl does using -u in the docker command work for you?

       -u, --user=""
          Sets the username or UID used and optionally the groupname or GID for the specified command.
          
docker run -u 1000:1000 -v ~/Downloads/photos:/mnt ivandokov/phockup:latest /mnt/Input /mnt/Output

Using the user flag works for a one shot but when running the docker command using the cron it fails due to permission denied.

Hello. Same problem here, #213 seem to fix the problem ?

Using the user flag works for a one shot but when running the docker command using the cron it fails due to permission denied.

ya so either phockup should own the files as a specified user or utilize its own scheduler over cron.

Hello. Same problem here, #213 seem to fix the problem ?

im not sure if this is a fix for file ownership when being run from docker.

something one could do is toss the docker command in a compose and then schedule that from where docker is run if needed:

services:
    phockup:
        image: ivandokov/phockup:latest
        container_name: phockup
        user: ${UID:-1000}:${GID:-1000}
        volumes:
            - /path/to/input/dir:/mnt/input
            - /path/to/output/dir:/mnt/output
        command: /mnt/input /mnt/output --move --original-names --date YYYY/MM