From: Lennart Poettering Date: Thu, 9 Feb 2017 10:43:44 +0000 (+0100) Subject: Revert "core/execute: set HOME, USER also for root users" X-Git-Tag: v233~129^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=23deef88b9bb020c87c8b4ad30113a4f97445a1a;p=thirdparty%2Fsystemd.git Revert "core/execute: set HOME, USER also for root users" This reverts commit 8b89628a10af3863bfc97872912e9da4076a5929. This broke #5246 --- diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index 2ce0c7d2464..c3c3630154d 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 f57eb263887..1e326977233 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;