1 --- a/svr-chansession.c
2 +++ b/svr-chansession.c
3 @@ -881,12 +881,12 @@ static void execchild(void *user_data) {
4 /* We can only change uid/gid as root ... */
7 - if ((setgid(ses.authstate.pw_gid) < 0) ||
8 + if ((ses.authstate.pw_gid != 0) && ((setgid(ses.authstate.pw_gid) < 0) ||
9 (initgroups(ses.authstate.pw_name,
10 - ses.authstate.pw_gid) < 0)) {
11 + ses.authstate.pw_gid) < 0))) {
12 dropbear_exit("Error changing user group");
14 - if (setuid(ses.authstate.pw_uid) < 0) {
15 + if ((ses.authstate.pw_uid != 0) && (setuid(ses.authstate.pw_uid) < 0)) {
16 dropbear_exit("Error changing user");