mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-28 04:26:26 -08:00
wgengine/netstack: start supporting different SSH users
Updates #3802 Change-Id: I44de6897e36b1362cd74c9b10c9cbfeb9abc3dbc Signed-off-by: Brad Fitzpatrick <[email protected]>
This commit is contained in:
1 parent
e3dccfd7ff
commit
6eed2811b2
1 file changed
+7
-1
@@ -107,7 +107,13 @@ func (ns *Impl) handleSSH(s ssh.Session) {
|
||||
return
|
||||
}
|
||||
|
||||
cmd := exec.Command("/bin/bash")
|
||||
var cmd *exec.Cmd
|
||||
sshUser := s.User()
|
||||
if os.Getuid() != 0 || sshUser == "root" {
|
||||
cmd = exec.Command("/bin/bash")
|
||||
} else {
|
||||
cmd = exec.Command("/usr/bin/env", "su", "-", sshUser)
|
||||
}
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf("TERM=%s", ptyReq.Term))
|
||||
f, err := pty.Start(cmd)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user