unix: call setgoups before calling setuid/setgid

Partial fix for #1093