Revert "core/execute: set HOME, USER also for root users"

This reverts commit 8b89628a10.

This broke #5246
This commit is contained in:
Lennart Poettering 2017-02-09 11:43:44 +01:00
parent 6f844e3a3f
commit 23deef88b9
2 changed files with 7 additions and 2 deletions

View File

@ -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>

View File

@ -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;