--- slurm-17.02.7/src/salloc/salloc.c.old 2017-10-05 13:25:52.403682572 -0400 +++ slurm-17.02.7/src/salloc/salloc.c 2017-10-05 13:29:52.913975815 -0400 @@ -333,8 +333,13 @@ sleep (++retries); } - /* become the user after the allocation has been requested. */ - if (opt.uid != (uid_t) -1) { + /* If the requested uid is different than ours, become that uid */ + if ((getuid() != opt.uid) && (opt.uid != (uid_t) -1)) { + /* drop extended groups before changing uid/gid */ + if ((setgroups(0, NULL) < 0)) { + error("setgroups: %m"); + exit(error_exit); + } if (setuid(opt.uid) < 0) { error("setuid: %m"); exit(error_exit);