Successfully migrated docker-based paperless-ngx to new DietPi-native paperless-ngx

Today arrived the long-awaited paperless-ngx support in dietpi-software. Thanks for adding it!

So far I had been running paperless-ngx in docker containers, which I was eager to get rid off :grinning_face_with_smiling_eyes:

This afternoon I updated DietPi to v10.9.3 and migrated my docker-based paperless-ngx setup to the new native DietPi paperless-ngx service, mainly by just using my daily document_exporter output with the importer and that’s it.

So far it seems to be working well, also scans from my ScanSnap S1300i scanner, that end up in the paperless-ngx/consume folder, are imported as expected into paperless-ngx. The only thing I needed to do was to change the permissions of the consume folder to 777 and add r-x permissions to its parent paperless-ngx folder. The scanbd tool I’ve configured stores files in the consume folder as saned:scanner.

Thanks for the feedback, great to hear the migration via exporter/importer worked!

The permissions are expected: the Paperless-ngx data directory is owned by paperless:dietpi with mode 0750, and the consume directory is group-writable (0775) for the dietpi group. Any other service that should drop files into it needs to be a member of that group. Instead of 777 and opening the parent directory to everyone (which makes all your stored documents and the database readable for every local user), I’d suggest:

usermod -aG dietpi saned
chmod 0750 /mnt/dietpi_userdata/paperless-ngx
chmod 0775 /mnt/dietpi_userdata/paperless-ngx/consume
systemctl restart scanbd

Just make sure scanbd creates the files readable (e.g. 644), and if it creates subfolders, they need to be group-writable so Paperless can remove the originals after import.

Good to hear. But try to avoid 777 mode where possible. Make the dir 775 or 770 instead (which probably was the case before), and add the Paperless-ngx service user to the scanner group:

sudo usermod -aG scanner paperless

EDIT: Ah, or is it about the dir within the Paperless-ngx dir :smile:? Then the other way round: Add saned to the dietpi group:

sudo usermod -aG dietpi saned

Both can make sense, they cover different directions:

  • usermod -aG dietpi saned is the required part: it allows scanbd to enter /mnt/dietpi_userdata/paperless-ngx (0750) and write into consume (0775), both owned by group dietpi. Restart scanbd afterwards.

  • usermod -aG scanner paperless is only needed if scanbd creates its files without read permission for others (e.g. 640/660 as saned:scanner). Then Paperless needs the scanner group to read them. Restart the Paperless services afterwards so the new group applies:

    systemctl restart paperless-consumer paperless-task-queue
    

With 644 files the first one alone is enough. Deleting the originals after import works either way, since that only needs write access to the directory.