Could you try this:
--8<---------------cut here---------------start------------->8---
(chdir "/tmp")
(setgroups #())
(setgid 30000)
(setuid 30001)
(pk 'uid/gid (getuid) (getgid))
(pk 'euid/egid (geteuid) (getegid))
(let loop ((i 3))
(when (< i 1024)
(false-if-exception (close-fdes i))
(loop (+ 1 i))))
(execl "/gnu/store/cnqmkmj40jmssnx6fkf9n0n3bqj5x426-guile-2.0.11/bin/guile"
"guile"
"-c" "(pk 'running (getuid) (geteuid))")
--8<---------------cut here---------------end--------------->8---
and then as root run:
# guile the-above-file.scm
It should return zero and print:
--8<---------------cut here---------------start------------->8---
;;; (uid/gid 30001 30000)
;;; (euid/egid 30001 30000)
;;; (running 30001 30001)
--8<---------------cut here---------------end--------------->8---
TIA,
Ludo’.