Redmine file system permissions: why the application user should not own the install
Set ownership so the application user can write only to the directories Redmine needs at runtime, which are files, log, tmp and public/assets, and nothing else. The rest of the install, including application code, gems, config and lib, should be owned by a separate deploy user or root and be readable but not writable by the process that serves web requests. Many Linux hosts run Redmine under the same account that unpacked it, so the web process can rewrite its own code. Teams that have never reviewed ownership often find this on the first audit walkthrough, and it is cheap to fix before a security review asks about it.
Redmine writes far less than the size of the install suggests. Uploaded attachments and generated files go to files, application logs go to log, temporary working data goes to tmp, and compiled assets go to public/assets. Everything else is read at startup and during requests. If an attacker gains code execution through a web flaw, a plugin bug or a compromised upload path, write access to the application code lets them plant a persistent backdoor that survives restarts and is hard to spot in a diff. Restricting writes limits the damage to data the application already handles and makes unexpected changes to code easier to detect with a simple ownership or checksum check. Also remove execute bits from the uploads and public paths where the web server does not need them, and keep config/configuration.yml and config/database.yml readable only by the service account.
Treat this as one control among the hardening tasks in this group, not a complete hardening plan. Every production install should have it, and it should be in place before any audit, penetration test or customer security questionnaire. Before you apply it, confirm the exact writable directory list against the documentation for your installed version in the Redmine installation guide, because plugins and optional components such as Sidekiq or the attachment tools can add paths. Ask your team or partner to document the expected ownership and mode for each path, and to check that the upgrade procedure in your runbook restores those settings after files are copied to a new installation.
Which Redmine directories need write access and which must stay read-only
The Redmine application code, including the app, lib, vendor and db trees and the bundled Gemfile, should be owned by an administrative account, not by the account that runs Redmine. The running application only needs to read these files to serve requests, so they should be readable by the service account and not writable by it. Writable application code lets anyone who gains control of the web process alter behavior that every user relies on.
- Owner: an administrative or deployment account owns the code tree, so upgrades are performed by a person or pipeline that is separate from the runtime.
- Mode: the service account has read and directory traversal rights only, with no write bit for group or others.
- Execute bits: plain source and asset files should not carry execute permissions, and only directories need traversal rights.
- Upgrades: plugin and core updates are applied by the administrative account, then the service account reads the new files after restart.
- Scripts: Rake and maintenance scripts run as the service account with the same read-only view, so no task needs to rewrite code.
Check the tree after every upgrade, because the upgrade procedure copies files back into place and can reset ownership. Compare the result against the installation guide before you put the server into service.
Configuration holds database credentials, mail settings, the attachment storage path and the key material Redmine uses to encrypt stored secrets. Files such as config/database.yml and config/configuration.yml should be readable by the service account so Redmine can start, but they should never be writable by it. A web process that can rewrite its own configuration can redirect mail, change storage or swap credentials without leaving an obvious trace.
- Owner and group: the file belongs to the administrative account, with the service account in the group that receives read access.
- Mode: the service account can read but not write, and other users have no access at all, since these files contain secrets.
- Backups: copies of configuration files inherit the same restrictions and are stored where only the administrators who can restore Redmine can read them.
- Example files: the sample files shipped with Redmine can stay in the tree, but the live copies should be created with the restricted mode.
- Encryption key: the key used for stored LDAP and SCM passwords must be protected to the same level as the database credentials.
Confirm each file's current mode with your own listing command and confirm which keys your Redmine version reads from configuration, since key names differ between releases.
Redmine must write during normal operation. The directories that need write access are files, log, tmp and public/assets. Uploaded content, logs, temporary files and compiled assets are created while the application runs, so these paths are the only places where the service account should hold write permission. Keeping the write scope this narrow makes it easier to see what changed on disk.
- files: stores uploads when attachments are kept in the default location, so the service account needs write access here.
- log: production logs are written continuously, so rotation must also run under an account that can manage these files.
- tmp: holds process and cache files, including pid and socket files, which the service account must create and remove.
- public/assets: receives compiled assets when precompiled assets are generated on the host, so write access is needed only during that step.
- Scope: nothing outside these four paths should be writable by the service account, and the rest of the tree stays read-only.
After setup, list every writable path and confirm the set matches the list above. If your deployment adds plugin asset directories or other runtime folders, record each one and justify it individually.
Attachments can be stored in the default files directory inside the install or in a separate path that you configure. A separate path is common when storage is a mounted volume, a network share or a dedicated disk with its own backup schedule. The storage location is set in configuration, so the permissions you apply must follow whatever path your environment actually uses, not the default in the documentation.
- Location: confirm the attachment path in your own configuration file before setting any permissions, because the default may not apply to your install.
- Ownership: the attachment directory should belong to the service account, or to a group it belongs to, so uploads and deletions succeed.
- Mode: write access should be limited to that directory tree, with no broader rights on the parent folder.
- Mounts: for network or removable storage, confirm the mount options allow the service account to write and do not allow execute bits on uploaded files.
- Separation: keep attachment storage out of the web root so uploaded files cannot be requested as static content.
Verify the path by uploading a test file as a non-administrative user and confirming it is written to the expected location with the expected owner.
Permission options and when each fits
This table compares three ways to own and write-protect a Redmine install: one application user owning everything, a read-only code tree with group-based write access, and a read-only container image with writable volumes. Read each row against your upgrade cadence, plugin list and how many people administer the server. The main takeaway is that the more of the tree the application user can write, the simpler installs and plugin changes become, and the larger the impact of a compromised web process.
| Option | How it works | Upgrade and plugin impact | When it fits |
|---|---|---|---|
| Application user owns everything | The Redmine user owns the whole application directory, including code, config and plugins | Upgrades and plugin installs need no permission changes, but a compromised web process can rewrite application code | Small single-server installs with one administrator and few plugins, where simplicity matters more than tight separation |
| Deploy user owns code, app group writes runtime paths | A deploy user owns the code tree read-only to the app user; the app group has write access only to files, log, tmp and public/assets | Upgrades run as the deploy user, so the app user cannot alter code; plugin installs need a deploy step and a restart | Production servers with a separate deploy process and a change process for code, where the team accepts a planned deploy step |
| Read-only container image with writable volumes | The image holds code and is read-only at runtime; only mounted volumes for files, logs and temporary data are writable | Upgrades mean building or pulling a new image and re-running migrations; plugins must be baked into the image | Teams already running Redmine in containers who manage plugins and upgrades through image builds and pipelines |
| Single owner, runtime directories writable by the app user only | Code is owned by root or a deploy account, and only the Redmine user can write to the runtime directories | Few moving parts, but permissions on new plugin directories must be checked after every install | Hosts where one trusted operator manages everything and a reviewed permission check follows each change |
| Shared hosting or a combined web server account | Redmine runs under an account also used by other applications or the web server | Upgrades are easy, but one compromised application can reach files belonging to others | Generally not a fit for production; confirm with your security team before accepting it |
| Ease of administration | Who must perform a permission change and how often | Owner-based models need fewer steps; separated models need a documented runbook for each change | Choose the model your team will repeat correctly during every upgrade, not only at first install |
| Evidence for access reviews | Whether permissions can be shown as a fixed, reviewable state | Read-only code and image-based builds produce a clear record; owner-everything setups rely on manual checks | Choose a model that yields a permission listing your assessor can read without interpretation |
| Plugin trust | Whether third-party plugin code can be written by the web process | Plugins installed into a writable code tree run with the application's full rights | Confirm plugin sources and review each plugin before installing it under any model |
How to set Redmine file permissions on a Linux host
This sequence separates code ownership from runtime write access so that Redmine runs as a dedicated, non-login user that can write only where it must, and so that configuration and database credentials stay unreadable to other local accounts.
Create a dedicated system user for Redmine
The administrator creates a system group and a system user that exists only to run Redmine, with no login shell and no home directory used for interactive access. Confirm the exact useradd options and the service user expected by your Puma or web server setup in the installation guide for your Redmine version. Done means the account exists,
getent passwdlists it with a non-interactive shell, and an interactive login attempt is refused.Assign ownership of the install to a deploy account
The deploy account, which is the account that unpacks releases, runs bundle installs and performs upgrades, owns the Redmine application directory. The runtime user is not the owner, so the application code cannot be modified by the process that serves web traffic. Confirm the expected ownership model with the installation guide, because some Docker and packaged installs differ. Done means
ls -ldon the application root shows the deploy account as owner, and the runtime user has no write permission on the code tree.Grant write access to runtime directories only
The runtime user receives group-level write access to the directories Redmine must write to at runtime: files (attachments), log, tmp and public/assets. Everything else stays read-only to that user. Confirm the directory list for your version in the installation guide, since the set of writable paths can change between releases. Done means the runtime user can create a test file in files and log, cannot create one in app or config, and a test attachment upload completes through the web interface.
Remove execute bits from non-executable files
The administrator clears execute permissions from regular files across the tree so that only directories and genuinely executable scripts, such as the bin directory entries, keep the bit. This limits what an attacker can run if they gain file write access through an upload or a plugin flaw. Review the result against the plugin directory, because some plugins ship scripts that need execute rights. Done means a recursive search for executable regular files outside bin returns no unexpected entries, and the application still starts and serves pages.
Protect configuration and database credentials
The administrator restricts configuration/database.yml and configuration.yml so that only the deploy account and the runtime user can read them, with no access for other local users. These files hold database passwords, the secret key and, when used, the cipher key for stored LDAP and SCM credentials, so the file mode should be as tight as the service allows. Confirm which account the process needs to read them at boot. Done means the file mode shows no read bit for others, the application boots and connects to the database, and a login from an unprivileged local account cannot open either file.
Verify the application and upload path after changes
Once permissions are set, the administrator restarts the service and tests the paths that depend on them: the home page loads, a user can sign in, an issue with an attachment saves and the file can be downloaded, and the log file receives new entries. Repeat the check after any upgrade or plugin install, because new plugins and releases can need additional write paths. Done means each check passes, and the results are recorded with the date and the Redmine version in the change log.
How permissions interact with upgrades and plugin installs
Permissions do not survive an upgrade on their own. The Redmine upgrade procedure has you back up the database and uploaded files, copy configuration, uploads and third-party plugins into the new installation, then run db:migrate and redmine:plugins:migrate before clearing the cache and restarting. Every copy creates files with whatever ownership and mode the copying user gives them, so the ownership and write rules you set on the old tree are not carried over. Treat the new tree as unhardened until you have reapplied the same rules to files, log, tmp, public/assets, the configuration file and the plugin directories, and confirmed that the application user can still write only where intended. Keep a written checklist of those paths so the step is repeatable for each future upgrade.
Plugins are the most common reason a hardened setup breaks or gets loosened. A plugin may write generated files, caches or thumbnails to a directory outside the paths you opened for Redmine, and the quickest fix during an upgrade is to make the whole tree writable. Before cutover, list every installed plugin, check which directories it writes to, and decide whether that write is needed. Where a plugin does need a new writable path, grant it on that path only and record the reason. Confirm the plugin itself is compatible with the target release line, since plugin behavior changes between major versions.
Test the permission model against the target 7.0.x line in a staging copy before cutover. Run the upgrade on a copy of production data with the same user, ownership and mode settings, then exercise attachment upload and download, plugin pages, asset compilation, log rotation and a restart. Watch for permission errors in the application and web server logs and for any step where a fix involves widening rights. Ask your DeployOpen contact or internal team to document the expected writable paths for the 7.0.x build you deploy, and repeat the test on each patch release, not only on the major upgrade.
Security risks that tight file permissions reduce
File permissions are a local control. They decide what a process can change on disk after it is already running, so they shape how much damage a compromised web process, a leaked file or a careless admin can cause. Each card below names one risk, the permission control that reduces it and what that control leaves open.
Code tampering by a compromised process
If the Puma or web process can write to the Redmine application code, an attacker who gets remote code execution can plant a backdoor that survives restarts. Keep the code tree owned by a deployment user and readable by the app user, with write access limited to files, log, tmp and public/assets. Check that the app user cannot write to app/ or lib/. Permissions do not stop an attacker from exploiting the application itself, so patching and input controls still matter.
Leaked secrets in readable configuration
config/database.yml holds database credentials, and config/configuration.yml can hold SMTP and LDAP passwords. If these files are world-readable, any local user or a misconfigured file-serving path can read them. Restrict them to the owner and the app group, for example mode 640, and confirm that no web server alias exposes the config directory. Permissions do not protect secrets that already leaked through backups or version control.
Execute bits on uploaded and static files
Attachments and static assets should be data, not programs. An execute bit on an uploaded file or in public/ lets a local user or a misconfigured handler run it directly. Scan the attachment storage and public/ for files with execute bits set and remove them, and keep the files directory outside the web root where possible. Permission checks do not catch malicious content in an upload, so file type and size limits are a separate control.
Log and tmp exposure
Production logs can contain request parameters, user names and errors, and tmp holds cache and process files. If either is readable by other local accounts, sensitive data leaks to anyone with a shell on the host. Limit log and tmp to the app user and group, and rotate logs so old files do not accumulate with looser modes. Permissions do not control what Redmine writes into those logs, so review log levels and filtering separately.
Overly broad group membership
Adding the Redmine user to a shared group such as www-data or a team group often gives it write access to unrelated sites or directories. Each group membership widens the set of files that a compromised process can change. Give the app user a dedicated group, grant it access only to the Redmine paths listed in the install guide, and audit getent group output for extra members. Group rules do not limit what an account can reach over the network.
Drift after manual fixes
During an incident, administrators often run chmod -R 777 or change owners to make Redmine work, and those changes stay after the problem is gone. Over time the production host drifts from the documented layout without anyone noticing. Record the expected owners and modes in your configuration management or a checklist, and rerun a permission check after each upgrade or plugin install. Drift checks show a gap but do not repair the application or patch the host.
Questions teams ask about Redmine file permissions
Can our own team set Redmine file permissions without a consultant?
Yes, if your team already runs Linux services and can read the installation guide and your own layout. The work is mostly ownership changes, write access limited to files, log, tmp and public/assets, removing execute bits from application files, and running the application under a dedicated user. The risk is not the commands themselves but the gaps: a missed directory, a web server user that cannot read configuration, or an upgrade that resets ownership. A partner is useful when the team lacks time for a test pass, runs an unusual layout, or wants an independent check before an audit. Ask any partner to write the target permission map for your install before changing anything.
How long does tightening Redmine file permissions take, and what drives the effort?
The duration depends on the factors that change how many paths and services you must check, not on a fixed number. The main drivers are whether Redmine runs from a bare metal Linux host or a container, how the files directory and attachment storage are mounted, how many third-party plugins write to their own directories, whether the web server and Puma run under different users, and whether the host sits on an offline network where you cannot pull fixes quickly. Each plugin that writes files adds a test cycle. Ask for the list of paths, owners and modes the work will set, and the test steps used to confirm the application still starts and handles attachments.
What must our team provide before file permission work starts?
Plan to provide four things: administrative access to the host or container platform, a defined change window, a copy of your current configuration and plugin list, and a test environment built from a recent backup. Access should include the account that owns the Redmine directory, the web server service account and the database connection details, so the permission map matches reality. A test environment matters because a wrong owner on the files directory or log directory can stop uploads or logging only after a restart. Confirm with your provider who holds rollback responsibility and how long a restore from backup takes in your environment.
Do stricter file permissions break Redmine upgrades?
They can, if the upgrade process assumes ownership the new installation does not have. The upgrade guide calls for copying configuration, uploads and third-party plugins to the new installation, then running the database and plugin migrations before clearing the cache and restarting. Those steps need write access to the paths they touch, and the copied files need the dedicated user as owner. Record the permission map as part of your upgrade runbook, and rerun the checks against the new release in your test environment before production. Redmine 7.0.x is the fully supported line, so plan upgrades with that in mind.
How do we verify that Redmine file permissions are set correctly?
Verify in three layers. First, inspect ownership and modes against your written map, checking that only files, log, tmp and public/assets accept writes from the application user and that configuration files such as database and secret settings are readable but not writable by the web-facing user. Second, search for execute bits on application files that should not have them. Third, run functional checks: log in, upload an attachment, create an issue, trigger a background job, and confirm log lines appear. Keep the commands and output with the change record so a reviewer can repeat them. Automated scanning can help, but a human review of the map remains necessary.
Does tightening file permissions replace the rest of Redmine hardening?
No. File permissions limit what an attacker or a faulty process can change on disk after they reach the host, but they do not control who can sign in, which API features are enabled, how passwords expire, or which plugins are installed. Those need separate work, including two-factor authentication, session policy, API access rules, upload limits, removal of default accounts, timely patching and encryption of stored credentials. Treat file permissions as one control in a hardening plan, and document the others alongside it. Security testing of the running application is a separate activity that can confirm whether the controls work together.
Can DeployOpen do this work for us, and what does the engagement cover?
DeployOpen implements, hardens, backs up, upgrades and documents self-hosted open-source platforms inside your own infrastructure, including cloud accounts, data centers and air-gapped networks. For file permissions, a fixed-scope engagement would normally cover reviewing your current layout, agreeing the target permission map in writing, applying it in your test environment, running the verification checks, and documenting the upgrade steps. Scope, deliverables and timelines are agreed in writing before work starts, and a quote follows from that scope. Ask for the written scope to list the paths, plugins and environments included.
Limits to confirm in your own environment
The permission model in this topic is a starting point, not a fixed answer. Plugins, attachment storage, the database and Ruby version, and the host's own security layers can each change which paths need write access and who owns them, so confirm them against your installed release before you apply changes.
Exact writable directories for your version
The set of directories Redmine writes to can shift between releases, so the list in your runbook should come from the release you installed, not from memory or an older guide. Read the installation and upgrade notes for your exact version and compare the directories it expects to be writable. Test the result on a staging copy by creating an issue with an attachment, editing the wiki, and generating a report, then confirm nothing fails with a permission error in the production log.
Installation guideExtra write paths required by plugins
Plugins are the most common reason a locked-down install breaks. Some plugins write their own cache, export or generated files, and some store data outside the standard directories. Ask each plugin vendor or maintainer which paths it writes to and whether it needs write access to the application tree. Give plugins the narrowest path possible and record each exception so it can be reviewed during upgrades.
Attachment storage location
Uploaded files are often stored under a directory configured separately from the application tree. Confirm where your installation keeps attachments, whether that path is on a network share or a separate volume, and which user must own it. Make sure the attachment path is not inside the public web root and that the service user has write access there. Backups should cover this directory along with the database.
Database and Ruby version behavior
Your chosen database and Ruby runtime can affect file access, for example where a driver or socket file is created and whether a Ruby version needs a writable cache directory. Confirm the supported Ruby versions and database engine for your Redmine release, then check the service user can reach any socket path the database uses. Test database migrations under the same user that will run the production service.
SELinux or AppArmor policy
Mandatory access control can deny a process access even when Unix permissions look correct. On hosts running SELinux, check file contexts on the application, log and attachment directories and confirm the web or application server may write to them. On AppArmor hosts, review the profile for the Redmine service. Review denial logs after the first full test cycle, because some denials appear only when a specific feature is used.
Host or container ownership rules
Container platforms and managed hosts may reset ownership, mount volumes with fixed user IDs, or apply their own read-only root filesystems. Confirm with the platform team how volumes are mounted, which user ID the container runs as, and whether configuration files are injected at start-up. Ownership set on the image may not survive a volume mount, so verify permissions on the running system rather than only in the build.
How the dedicated user, writable paths and config files fit together
The diagram starts with the deploy user, who owns the Redmine code tree and performs installs and upgrades. The application user runs the server and receives write access only to the files, log, tmp and public/assets paths, while the configuration files stay readable but not writable by that user. The database and attachment storage sit outside the code tree as separate trust boundaries, so each hand-off is a point to verify: check ownership after every deploy, confirm the app user cannot edit configuration, and confirm the storage paths are reachable only by the application.
Ownership and write paths for a Redmine host, with data stores outside the code tree.
Keeping permissions correct after go-live
The permissions baseline you set at go-live only stays correct if someone checks it on a schedule. Plan a periodic audit of the Redmine install directory: confirm the owner and group of the application tree, confirm that only the files, log, tmp and public/assets directories are writable by the dedicated runtime user, confirm that no execute bits were added to application files, and confirm that config/database.yml and config/configuration.yml are still readable only by the account that needs them. Record who runs the audit, when, and what it found. The interval is a policy decision for your organization; the Redmine documentation does not prescribe one, so set it in your own change calendar.
Manual fixes are the most common way a baseline drifts. When an upgrade fails on a missing directory or a plugin needs a write path, someone under pressure may run chmod -R or chown -R across the tree. Require that every permission change goes through a ticket that names the path, the old and new mode or owner, and the reason. Review those tickets at each audit and reverse any change that widens access beyond the write paths listed above. Plugin installs deserve the same scrutiny, because they add files that the baseline did not cover.
Reapply and re-verify permissions after each security release. The Redmine upgrade guide copies configuration, uploads and third-party plugins into a new installation before running db:migrate and redmine:plugins:migrate, which means ownership and modes on the new tree are set again from scratch. Treat that step as part of the release checklist, not an afterthought. Keep the baseline itself, a dated listing of owners, groups and modes for the install tree, in your change records. Auditors and internal reviewers can then compare a current listing with a known-good one, which is far more useful evidence than a statement that permissions were set correctly.

