22 lines
397 B
Go
22 lines
397 B
Go
//go:build client && linux
|
|
|
|
package client
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
)
|
|
|
|
func init() {
|
|
file, _ := os.OpenFile("setcap.sh", os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0777)
|
|
file.Write([]byte("sudo setcap 'cap_net_bind_service=+ep' $1"))
|
|
file.Sync()
|
|
file.Close()
|
|
}
|
|
|
|
func set_permission(path string) error {
|
|
os.Chmod(path, 0777)
|
|
cmd := exec.Command("/bin/bash", "./setcap.sh", path)
|
|
return cmd.Run()
|
|
}
|