Project

General

Profile

Access rights issue with the “Files” folder

Added by Clement RESCHKE 1 day ago

Hello,

I'm having a problem with the “Files” folder in my Redmine.
The permissions "expire" after a few weeks, and attachments are no longer imported into tickets.
I need to rerun the command `chmod -R a+w /var/www/redmine/files`
I don't have anything in my crontab that could be causing this.
Do you have any ideas?
Here are the permissions for the “Files” folder:
drwxrwxrwx 12 www-data www-data 4096 June 19 12:24 files

Environment:
Redmine version 6.1.3.stable
Ruby version 3.3.8-p144 (2025-04-09) [x86_64-linux-gnu]
Rails version 7.2.3.1
Environment production
Database adapter Mysql2
SCM:
Git 2.47.3
Filesystem
Redmine plugins:
redmine_ai_helper 3.2.0
redmine_extended_watchers 6.1.0
Debian Version: 13.5

Thank you


Replies (3)

RE: Access rights issue with the “Files” folder - Added by Jobin @ RedminePRO 1 day ago

Hello Clement,

This usually happens when files or subdirectories inside /var/www/redmine/files are being created or touched by a process running under a different user account (such as root or a deployment user) rather than www-data.

- Check ownership of newly created files

Next time the issue happens before running chmod, check which specific subdirectories or files lost permissions:

ls -ld /var/www/redmine/files
ls -laR /var/www/redmine/files

If you see files owned by `root` or another user, identify what created them, may be a system cron or a daily cron set in /etc/crond.d/ directories or /etc/crontab. Or backup scripts interact with the directory under a different user account or default umask.

-
Jobin - RedminePRO

RE: Access rights issue with the “Files” folder - Added by Clement RESCHKE 1 day ago

After checking, I found this in my cron jobs.
/etc/cron.d:
30 3 * * 0 root test -e /run/systemd/system || SERVICE_MODE=1 /usr/libexec/e2fsprogs/e2scrub_all_cron
10 3 * * * root test -e /run/systemd/system || SERVICE_MODE=1 /sbin/e2scrub_all -A -r

For checking system files.

And in my crontab -e to import emails.

*/1 * * * * /usr/bin/rake -f /var/www/redmine/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=IP username=USER password=PASSWORD unknown_user=create no_permission_check=1 project=new-requests allow_override=Tracker,Priority,Project,Status

The files belong to root in the Files/ directory because the crontab is run by the root user, I think.

Could that be the cause?

RE: Access rights issue with the “Files” folder - Added by Jobin @ RedminePRO 1 day ago

You can check the timestamp of the file permission change to get an idea.

Also, check the cron service's system log to identify the culprit.

    (1-3/3)