diff --git a/src/bin/multiuser/login.cpp b/src/bin/multiuser/login.cpp index d4dfba5181..ff6efa5792 100644 --- a/src/bin/multiuser/login.cpp +++ b/src/bin/multiuser/login.cpp @@ -156,6 +156,12 @@ setup_environment(struct passwd* passwd, bool preserveEnvironment) if (ioctl(STDIN_FILENO, TIOCSPGRP, &pid) != 0) return errno; + if (passwd->pw_gid && setgid(passwd->pw_gid) != 0) + return errno; + + if (passwd->pw_uid && setuid(passwd->pw_uid) != 0) + return errno; + const char* home = getenv("HOME"); if (home == NULL) return B_ENTRY_NOT_FOUND;