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://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=8aa75193662d0e18d7c21ee9d546b7f3c8b8bc14;p=elogind.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 cbeb0caf2..50d2d49ba 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) {