Reload linux user groups from a Golang automation script
We have a Go automation script which creates Linux users, the script runs under a different user, called scriptuser
but this script uses exec.Command
to create new users. The problem is we want to add the user scriptuser
inside the newly created user’s group, so that the scriptuser
can read/write into the user’s home directory whenever it needs to make new changes. We are able to add the scriptuser
to the newly created user’s group without any issues but the script user’s groups are not being changed unless we logout and log back in from the shell. How can we achieve this without logging out and logging back in.
setuid when using exec.Cmd.Start()
Is it possible to configure a Cmd to set the UID+GID of a process started with exec.Cmd.Start()? I’m looking for behavior similar to libuv_spawn where I can set UV_PROCESS_SET{UID,GID} and pass those in as options.