ivandokov / phockup

Media sorting tool to organize photos and videos from your camera in folders by year, month and day.
MIT License
854 stars 108 forks source link

Moved files can not be deleted #145

Open moritzfl opened 2 years ago

moritzfl commented 2 years ago

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).

ivandokov commented 2 years ago

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.

JoshuaCrewe commented 1 year ago

@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
JoshuaCrewe commented 1 year ago

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

fabiencharrasse commented 1 year ago

Hello. Same problem here, https://github.com/ivandokov/phockup/pull/213 seem to fix the problem ?

kinghat commented 7 months ago

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