576df0
diff --git a/modules/md/mod_md_os.c b/modules/md/mod_md_os.c
576df0
index f96d566..8df0248 100644
576df0
--- a/modules/md/mod_md_os.c
576df0
+++ b/modules/md/mod_md_os.c
576df0
@@ -41,14 +41,20 @@
576df0
 
576df0
 apr_status_t md_try_chown(const char *fname, unsigned int uid, int gid, apr_pool_t *p)
576df0
 {
576df0
-#if AP_NEED_SET_MUTEX_PERMS
576df0
-    if (-1 == chown(fname, (uid_t)uid, (gid_t)gid)) {
576df0
-        apr_status_t rv = APR_FROM_OS_ERROR(errno);
576df0
-        if (!APR_STATUS_IS_ENOENT(rv)) {
576df0
-            ap_log_perror(APLOG_MARK, APLOG_ERR, rv, p, APLOGNO(10082)
576df0
-                         "Can't change owner of %s", fname);
576df0
+#if AP_NEED_SET_MUTEX_PERMS && HAVE_UNISTD_H
576df0
+    /* Since we only switch user when running as root, we only need to chown directories
576df0
+     * in that case. Otherwise, the server will ignore any "user/group" directives and
576df0
+     * child processes have the same privileges as the parent.
576df0
+     */
576df0
+    if (!geteuid()) {
576df0
+        if (-1 == chown(fname, (uid_t)uid, (gid_t)gid)) {
576df0
+            apr_status_t rv = APR_FROM_OS_ERROR(errno);
576df0
+            if (!APR_STATUS_IS_ENOENT(rv)) {
576df0
+                ap_log_perror(APLOG_MARK, APLOG_ERR, rv, p, APLOGNO(10082)
576df0
+                              "Can't change owner of %s", fname);
576df0
+            }
576df0
+            return rv;
576df0
         }
576df0
-        return rv;
576df0
     }
576df0
     return APR_SUCCESS;
576df0
 #else 
576df0
@@ -58,11 +64,7 @@ apr_status_t md_try_chown(const char *fname, unsigned int uid, int gid, apr_pool
576df0
 
576df0
 apr_status_t md_make_worker_accessible(const char *fname, apr_pool_t *p)
576df0
 {
576df0
-#if AP_NEED_SET_MUTEX_PERMS
576df0
     return md_try_chown(fname, ap_unixd_config.user_id, -1, p);
576df0
-#else 
576df0
-    return APR_ENOTIMPL;
576df0
-#endif
576df0
 }
576df0
 
576df0
 #ifdef WIN32