src/resolve/resolved-gperf.c
 
 systemd_resolved_LDADD = \
+       libsystemd-capability.la \
        libsystemd-network.la \
        libsystemd-label.la \
        libsystemd-internal.la \
 
         facing service will drop privileges (with the exception of
         CAP_NET_*) and assumed this uid/gid for security reasons.
 
+        The name resolution daemon requires the "systemd-resolve"
+        system user and group to exist. During execution this network
+        facing service will drop privileges and assume this uid/gid
+        for security reasons.
+
 WARNINGS:
         systemd will warn you during boot if /etc/mtab is not a
         symlink to /proc/mounts. Please ensure that /etc/mtab is a
 
 #include "resolved.h"
 
 #include "mkdir.h"
+#include "capability.h"
 
 int main(int argc, char *argv[]) {
         _cleanup_manager_free_ Manager *m = NULL;
+        const char *user = "systemd-resolve";
+        uid_t uid;
+        gid_t gid;
         int r;
 
         log_set_target(LOG_TARGET_AUTO);
                 goto out;
         }
 
+        r = get_user_creds(&user, &uid, &gid, NULL, NULL);
+        if (r < 0) {
+                log_error("Cannot resolve user name %s: %s", user, strerror(-r));
+                goto out;
+        }
+
         /* Always create the directory where resolv.conf will live */
-        r = mkdir_label("/run/systemd/resolve", 0755);
-        if (r < 0)
+        r = mkdir_safe_label("/run/systemd/resolve", 0755, uid, gid);
+        if (r < 0) {
                 log_error("Could not create runtime directory: %s",
                           strerror(-r));
+                goto out;
+        }
+
+        r = drop_privileges(uid, gid, 0);
+        if (r < 0)
+                goto out;
 
         r = manager_new(&m);
         if (r < 0) {