cmd/tailscaled: on darwin, fail early if not root with nicer message

Don't do it on all platforms, as Linux folk might be playing
container + capability games.
This commit is contained in:
Brad Fitzpatrick 2021-02-17 15:45:50 -08:00
parent 3e5c3e932c
commit 38629b62fc

View File

@ -131,7 +131,13 @@ func main() {
os.Exit(0)
}
if runtime.GOOS == "darwin" && os.Getuid() != 0 {
log.SetFlags(0)
log.Fatalf("tailscaled requires root; use sudo tailscaled")
}
if args.socketpath == "" && runtime.GOOS != "windows" {
log.SetFlags(0)
log.Fatalf("--socket is required")
}