From 23deef88b9bb020c87c8b4ad30113a4f97445a1a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 9 Feb 2017 11:43:44 +0100 Subject: Revert "core/execute: set HOME, USER also for root users" This reverts commit 8b89628a10af3863bfc97872912e9da4076a5929. This broke #5246 --- man/systemd.exec.xml | 4 +++- src/core/execute.c | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index 2ce0c7d246..c3c3630154 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -1705,7 +1705,9 @@ $SHELL User name (twice), home directory, and the - login shell. See + login shell. The variables are set for the units that have + User= set, which includes user + systemd instances. See passwd5. diff --git a/src/core/execute.c b/src/core/execute.c index f57eb26388..1e32697723 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -815,10 +815,13 @@ static int get_fixed_user(const ExecContext *c, const char **user, assert(c); + if (!c->user) + return 0; + /* Note that we don't set $HOME or $SHELL if they are not particularly enlightening anyway * (i.e. are "/" or "/bin/nologin"). */ - name = c->user ?: "root"; + name = c->user; r = get_user_creds_clean(&name, uid, gid, home, shell); if (r < 0) return r; -- cgit v1.2.3-54-g00ecf