You mean "chown root app; chmod 4755 app" ? Rich a következőt írta (2021. szeptember 20., hétfő, 16:57:38 UTC+2):
> I am trying to create a go program so that I can peform an action that is > more complex than the example I have below. I can't give sudo right so run > the application due to some policy we have at work that certain groups can > only have read permissions. The company also have a policy that states any > new directory / file is set with restrictive permissions. What I wanted to > do is create a program that runs as root. (Like ping runs as root) but it > doesn't seem to work. > > package main > > import ( > "fmt" > "os" > "os/exec" > ) > > func main() { > cmd:=exec.Command("chmod","770", "/opt/app/mnt/mydirectory") > cmd.Stdout = os.Stdout > cmd.Stderr = os.Stderr > err:=cmd.Run() > if err != nil { > fmt.Println("ERROR:", err) > } > } > > When I compile, then do a chmod 4755, and run it. I get a permissions > denied. Looking for why this would be? > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/df521cb8-432c-4dfc-93be-80197d9bb3e9n%40googlegroups.com.