diff --git a/man/logind.conf.xml b/man/logind.conf.xml index 6e587c3561..3217ece21a 100644 --- a/man/logind.conf.xml +++ b/man/logind.conf.xml @@ -124,7 +124,9 @@ corresponding to the session and all processes inside that scope will be terminated. If false, the scope is "abandonded", see systemd.scope5, - and processes are not killed. Defaults to yes. + and processes are not killed. Defaults to yes, + but see the options KillOnlyUsers= and + KillExcludeUsers= below. In addition to session processes, user process may run under the user manager unit user@.service. Depending on the linger @@ -147,17 +149,16 @@ KillOnlyUsers= KillExcludeUsers= - These settings take space-separated lists of usernames that - determine to which users the KillUserProcesses= setting - applies. A user name may be added to KillExcludeUsers= to - exclude the processes in the session scopes of that user from being killed even if - KillUserProcesses=yes is set. If - KillExcludeUsers= is not set, the root user - is excluded by default. KillExcludeUsers= may be set to an - empty value to override this default. If a user is not excluded, - KillOnlyUsers= is checked next. A list of user names may be - specified in KillOnlyUsers=, to only include those - users. Otherwise, all users are included. + These settings take space-separated lists of usernames that override + the KillUserProcesses= setting. A user name may be added to + KillExcludeUsers= to exclude the processes in the session scopes of + that user from being killed even if KillUserProcesses=yes is set. If + KillExcludeUsers= is not set, the root user is + excluded by default. KillExcludeUsers= may be set to an empty value + to override this default. If a user is not excluded, KillOnlyUsers= + is checked next. If this setting is specified, only the session scopes of those users + will be killed. Otherwise, users are subject to the + KillUserProcesses=yes setting. diff --git a/src/login/logind-core.c b/src/login/logind-core.c index 73075274e0..cbf8d757fe 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -364,19 +364,16 @@ bool manager_shall_kill(Manager *m, const char *user) { assert(m); assert(user); - if (!m->kill_user_processes) - return false; - if (!m->kill_exclude_users && streq(user, "root")) return false; if (strv_contains(m->kill_exclude_users, user)) return false; - if (strv_isempty(m->kill_only_users)) - return true; + if (!strv_isempty(m->kill_only_users)) + return strv_contains(m->kill_only_users, user); - return strv_contains(m->kill_only_users, user); + return m->kill_user_processes; } static int vt_is_busy(unsigned int vtnr) {