summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-02-09 11:43:44 +0100
committerLennart Poettering <lennart@poettering.net>2017-02-09 11:43:44 +0100
commit23deef88b9bb020c87c8b4ad30113a4f97445a1a (patch)
tree6815cee137388a58a52dae3ab07a27b3fe33426a
parent6f844e3a3f97d2b3fce9d37714575177b9ff3f4c (diff)
Revert "core/execute: set HOME, USER also for root users"
This reverts commit 8b89628a10af3863bfc97872912e9da4076a5929. This broke #5246
-rw-r--r--man/systemd.exec.xml4
-rw-r--r--src/core/execute.c5
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 @@
<term><varname>$SHELL</varname></term>
<listitem><para>User name (twice), home directory, and the
- login shell. See
+ login shell. The variables are set for the units that have
+ <varname>User=</varname> set, which includes user
+ <command>systemd</command> instances. See
<citerefentry project='die-net'><refentrytitle>passwd</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para></listitem>
</varlistentry>
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;