Add elevation for dangerous ssh flags

This commit is contained in:
Theodor S. Midtlien
2026-07-24 21:30:10 +02:00
parent 0bb73b3730
commit cd98648a67
11 changed files with 383 additions and 5 deletions
+17
View File
@@ -0,0 +1,17 @@
//go:build !linux && !darwin && !windows
package cmd
import (
"fmt"
"os"
"strings"
)
// isProcessPrivileged reports whether the current process runs as root.
func isProcessPrivileged() bool { return os.Geteuid() == 0 }
// runElevated has no automatic elevation mechanism on these platforms
func runElevated(exe string, args []string) error {
return fmt.Errorf("automatic privilege elevation is not supported on this platform, re-run as root: sudo %s %s", exe, strings.Join(args, " "))
}