diff --git a/docs/configuration/environment-variables.md b/docs/configuration/environment-variables.md
index 3bfffe858..4bc72d5bb 100644
--- a/docs/configuration/environment-variables.md
+++ b/docs/configuration/environment-variables.md
@@ -115,4 +115,6 @@ The following list config variables have special meaning and can be set in a var
| `DOKKU_SKIP_CLEANUP` | | `/etc/environment`
`~dokku/.dokkurc`
`~dokku/.dokkurc/*` | When a deploy is triggered, if this is set to a non-empty value, then old docker containers and images will not be removed. |
| `DOKKU_SKIP_DEFAULT_CHECKS` | | `dokku config:set` | |
| `DOKKU_SKIP_DEPLOY` | | `dokku config:set` | |
+| `DOKKU_SYSTEM_GROUP` | `dokku` | `/etc/environment`
`~dokku/.dokkurc`
`~dokku/.dokkurc/*` | System group to chown files as. |
+| `DOKKU_SYSTEM_USER` | `dokku` | `/etc/environment`
`~dokku/.dokkurc`
`~dokku/.dokkurc/*` | System user to chown files as. |
| `DOKKU_WAIT_TO_RETIRE` | `60` | `dokku config:set` | After a successful deploy, the grace period given to old containers before they are stopped/terminated. This is useful for ensuring completion of long-running http connections. |
diff --git a/plugins/common/properties.go b/plugins/common/properties.go
index 88717fcc2..61da772f3 100644
--- a/plugins/common/properties.go
+++ b/plugins/common/properties.go
@@ -142,11 +142,20 @@ func setPermissions(path string, fileMode os.FileMode) (err error) {
return err
}
- group, err := user.LookupGroup("dokku")
+ systemGroup := os.Getenv("DOKKU_SYSTEM_GROUP")
+ systemUser := os.Getenv("DOKKU_SYSTEM_USER")
+ if systemGroup == "" {
+ systemGroup = "dokku"
+ }
+ if systemUser == "" {
+ systemUser = "dokku"
+ }
+
+ group, err := user.LookupGroup(systemGroup)
if err != nil {
return
}
- user, err := user.Lookup("dokku")
+ user, err := user.Lookup(systemUser)
if err != nil {
return
}