diff --git a/main.c b/main.c index 9a4a098..ce9fd6b 100644 --- a/main.c +++ b/main.c @@ -566,7 +566,11 @@ int change_user_group () { if (setuid (pw->pw_uid) < 0) { fprintf (stderr, "change_user_group: failed to assume identity of user %s\n", username); return -1; - } + } else { + pw = getpwuid(getuid()); + setenv("USER", pw->pw_name, 1); + setenv("HOME", pw->pw_dir, 1); + setenv("SHELL", pw->pw_shell, 1); } return 0; }