mirror of
https://github.com/lxc/incus.git
synced 2026-02-05 09:46:19 +01:00
21 lines
421 B
Go
21 lines
421 B
Go
//go:build linux && cgo
|
|
|
|
package subprocess
|
|
|
|
import (
|
|
"syscall"
|
|
)
|
|
|
|
// SetUserns allows running inside of a user namespace.
|
|
func (p *Process) SetUserns(uidMap []syscall.SysProcIDMap, gidMap []syscall.SysProcIDMap) {
|
|
p.SysProcAttr = &syscall.SysProcAttr{
|
|
Cloneflags: syscall.CLONE_NEWUSER,
|
|
Credential: &syscall.Credential{
|
|
Uid: uint32(0),
|
|
Gid: uint32(0),
|
|
},
|
|
UidMappings: uidMap,
|
|
GidMappings: gidMap,
|
|
}
|
|
}
|