Using the os/exec package, I want to run an external command on a *nix OS, on behalf of another user (of course go process run under root user of another user w
os/exec
You can add a syscall.Credential struct to Cmd.SysProcAttr
cmd := exec.Command(command, args...) cmd.SysProcAttr = &syscall.SysProcAttr{} cmd.SysProcAttr.Credential = &syscall.Credential{Uid: uid, Gid: gid}