Permission error when uploading videos #63

Open
opened 2026-08-25 16:17:34 +00:00 by Numerica · 3 comments
Contributor

Log is:
2026-08-25T16:13:44.161840194Z ERROR 2026-08-25T16:13:44.161Z pid=19 tid=34wxl7 jid=121bb4a88995df6055451c37 class=PostProcessMediaWorker: Processing media attachment 117157028892198364 failed with Permission denied @ apply2files - /opt/mastodon/public/system/media_attachments/files/117/157/028/892/198/364/original/2b65a82f6a805792.webm

In the files folder everything belongs to root (except the first two folders), is it supposed to be?

Apparently the video processor (Paperclip) doesn't have sudo and cannot access this folders

Is it safe to just chown everything to mastodon:mastodon?

Or does it have to be fixed in the recipe or docker rather?

Log is: `2026-08-25T16:13:44.161840194Z ERROR 2026-08-25T16:13:44.161Z pid=19 tid=34wxl7 jid=121bb4a88995df6055451c37 class=PostProcessMediaWorker: Processing media attachment 117157028892198364 failed with Permission denied @ apply2files - /opt/mastodon/public/system/media_attachments/files/117/157/028/892/198/364/original/2b65a82f6a805792.webm` In the **files** folder **everything belongs to root** (except the first two folders), is it supposed to be? Apparently the video processor (Paperclip) doesn't have sudo and cannot access this folders Is it safe to just _chown_ everything to **mastodon:mastodon**? Or does it have to be fixed in the recipe or docker rather?
Author
Contributor

it's #10

it's #10
Owner

@Numerica

Is it safe to just chown everything to mastodon:mastodon?

Yes — but I think @decentral1se was saying over in #10 that it might be necessary to do it on the host using the numeric UID / GID; maybe the mastodon container doesn't have permission by default? abra app run -u root ... app might also do it.

@Numerica > Is it safe to just chown everything to mastodon:mastodon? Yes — but I think @decentral1se was saying over in #10 that it might be necessary to do it on the host using the numeric UID / GID; maybe the mastodon container doesn't have permission by default? `abra app run -u root ... app` might also do it.

The issue seems to come from compose.character-limit.yml.

The app service runs as root to apply the sed changes, but this command:

su -c "RAILS_ENV=production bundle exec rails s -p 3000"
also leaves Rails/Puma running as root. As a result, uploaded media files are created as root:root, while Sidekiq runs as mastodon (991:991). This causes video post-processing to fail with permission errors.

Changing it to:

exec su -s /bin/sh -c "RAILS_ENV=production bundle exec rails s -p 3000" mastodon

fixes the problem.

Tested with Mastodon 4.5.10: Puma runs as mastodon and video uploads work correctly.

It would be good to integrate this change into compose.character-limit.yml.

The issue seems to come from `compose.character-limit.yml`. The app service runs as root to apply the sed changes, but this command: `su -c "RAILS_ENV=production bundle exec rails s -p 3000" ` also leaves Rails/Puma running as root. As a result, uploaded media files are created as root:root, while Sidekiq runs as mastodon (991:991). This causes video post-processing to fail with permission errors. Changing it to: `exec su -s /bin/sh -c "RAILS_ENV=production bundle exec rails s -p 3000" mastodon` fixes the problem. Tested with Mastodon 4.5.10: Puma runs as mastodon and video uploads work correctly. It would be good to integrate this change into `compose.character-limit.yml`.
Sign in to join this conversation.
No labels
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: coop-cloud/mastodon#63