diff --git a/src/core/main.c b/src/core/main.c index 9db83aa2e53..9bcedbe71f6 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1350,6 +1350,12 @@ int main(int argc, char *argv[]) { unsetenv("SHLVL"); unsetenv("_"); + /* When we are invoked by a tool chroot-like such as + * nspawn, these might be set, but make little sense + * to pass on */ + unsetenv("USER"); + unsetenv("LOGNAME"); + /* All other variables are left as is, so that clients * can still read them via /proc/1/environ */ }