summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-08-30 13:21:55 +0200
committerLennart Poettering <lennart@poettering.net>2021-08-30 13:37:06 +0200
commit966f3a246c8c804d8a9c9d393f03c5c3fe0dd393 (patch)
tree72462bc7b61b2a4f9d3bf9ff7761003da6e89db1 /src/systemctl
parent93d2e0b6b0dd91d1a4aa89bfed56b3285a5070cb (diff)
downloadsystemd-966f3a246c8c804d8a9c9d393f03c5c3fe0dd393.tar.gz
run/mount/systemctl: don't fork off PolicyKit/ask-pw agent when in --user mode
When we are in --user mode there's no point in doing PolicyKit/ask-pw because both of these systems are only used by system-level services. Let's disable the two agents for that automaticlly hence. Prompted by: #20576
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index f5ecc1f60f..e2a8aef114 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -925,6 +925,11 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
assert_not_reached();
}
+ /* If we are in --user mode, there's no point in talking to PolicyKit or the infra to query system
+ * passwords */
+ if (arg_scope != UNIT_FILE_SYSTEM)
+ arg_ask_password = false;
+
if (arg_transport == BUS_TRANSPORT_REMOTE && arg_scope != UNIT_FILE_SYSTEM)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Cannot access user instance remotely.");