Acting in independant user group / user account

95 views
Skip to first unread message

LiteLotus

unread,
Aug 10, 2024, 11:01:20 PM8/10/24
to golang-nuts
i want to do something similar to docker, where the application im making executes as its own user, and the user interacting with it should be in the same group as the application, whats the best method to do this in go?


Jason E. Aten

unread,
Aug 14, 2024, 11:01:13 PM8/14/24
to golang-nuts
Its not clear to me if you are wanting to manipulation the ownership group or the process group.

The ownership group is usually modified in the shell with chgrp. From a program, you could

If you want a new process to have its own process group, you can do something like this in Go:

cmd := exec.Command(path, args...)

c.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}

See https://pkg.go.dev/syscall#SysProcAttr and the Setpgid doc there




Reply all
Reply to author
Forward
0 new messages