MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / IsRoot

Method IsRoot

core/utils/ssh/ssh.go:123–129  ·  view source on GitHub ↗
(user string)

Source from the content-addressed store, hash-verified

121}
122
123func (c *SSHClient) IsRoot(user string) bool {
124 if user == "root" {
125 return true
126 }
127 _, err := c.Run("sudo -n true")
128 return err == nil
129}
130
131func (c *SSHClient) Runf(shell string, args ...interface{}) (string, error) {
132 shell = c.SudoItem + " " + shell

Callers

nothing calls this directly

Calls 1

RunMethod · 0.95

Tested by

no test coverage detected