diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index 699f6e263f..8079b4b210 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -1694,9 +1694,7 @@ $SHELL User name (twice), home directory, and the - login shell. The variables are set for the units that have - User= set, which includes user - systemd instances. See + login shell. See passwd5. diff --git a/src/core/execute.c b/src/core/execute.c index 47cc4311c1..67b54a3bec 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -815,13 +815,10 @@ 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; + name = c->user ?: "root"; r = get_user_creds_clean(&name, uid, gid, home, shell); if (r < 0) return r;