summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 9db83aa2e5..9bcedbe71f 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 */
}