Skip to content

Commit bb111f9

Browse files
authored
Merge pull request #465 from aanderse/master
Set USER and LOGNAME environment variables when dropping privileges
2 parents c7faf4f + abaad56 commit bb111f9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/service.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,11 @@ static pid_t service_fork(svc_t *svc)
627627
set_uid(uid, svc);
628628

629629
/* Set default path for regular users */
630-
if (uid > 0)
630+
if (uid > 0) {
631631
setenv("PATH", _PATH_DEFPATH, 1);
632+
setenv("USER", svc->username, 1);
633+
setenv("LOGNAME", svc->username, 1);
634+
}
632635
if (home) {
633636
setenv("HOME", home, 1);
634637
if (chdir(home)) {

0 commit comments

Comments
 (0)