From: Lennart Poettering Date: Wed, 10 Jul 2013 23:56:12 +0000 (+0200) Subject: core: grant user@.service instances write access to their own cgroup X-Git-Tag: v206~146 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8aa75193662d0e18d7c21ee9d546b7f3c8b8bc14;p=thirdparty%2Fsystemd.git core: grant user@.service instances write access to their own cgroup --- diff --git a/src/core/execute.c b/src/core/execute.c index cbeb0caf262..50d2d49ba8f 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -1258,6 +1258,23 @@ int exec_spawn(ExecCommand *command, } } +#ifdef HAVE_PAM + if (cgroup_path && context->user && context->pam_name) { + err = cg_set_task_access(SYSTEMD_CGROUP_CONTROLLER, cgroup_path, 0644, uid, gid); + if (err < 0) { + r = EXIT_CGROUP; + goto fail_child; + } + + + err = cg_set_group_access(SYSTEMD_CGROUP_CONTROLLER, cgroup_path, 0755, uid, gid); + if (err < 0) { + r = EXIT_CGROUP; + goto fail_child; + } + } +#endif + if (apply_permissions) { err = enforce_groups(context, username, gid); if (err < 0) {