【Golang】exec.Commandを使って別ユーザーの権限でコマンドを実行したい
サンプルコード package main import ( "fmt" "os/exec" "os/user" "strconv" "syscall" ) func main() { username := "test" u, _ := user.Lookup(username) uid, _ := strconv.Atoi(u.Uid) gid, _ := strconv.Atoi(u.Gid) cmd :...
Oct 30, 20221 min read249