diff --git a/ssh/tailssh/incubator.go b/ssh/tailssh/incubator.go index ea54cbbf7..873559e76 100644 --- a/ssh/tailssh/incubator.go +++ b/ssh/tailssh/incubator.go @@ -206,7 +206,7 @@ func beIncubator(args []string) error { // If we are trying to launch a login shell, just exec into login // instead. We can only do this if a TTY was requested, otherwise login // exits immediately, which breaks things likes mosh and VSCode. - return unix.Exec(ia.loginCmdPath, []string{ia.loginCmdPath, "-f", ia.localUser, "-h", ia.remoteIP, "-p"}, os.Environ()) + return unix.Exec(ia.loginCmdPath, ia.loginArgs(), os.Environ()) } // Inform the system that we are about to log someone in. diff --git a/ssh/tailssh/incubator_darwin.go b/ssh/tailssh/incubator_darwin.go new file mode 100644 index 000000000..d143883e6 --- /dev/null +++ b/ssh/tailssh/incubator_darwin.go @@ -0,0 +1,9 @@ +// Copyright (c) 2022 Tailscale Inc & AUTHORS All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tailssh + +func (ia *incubatorArgs) loginArgs() []string { + return []string{ia.loginCmdPath, "-fp", "-h", ia.remoteIP, ia.localUser} +} diff --git a/ssh/tailssh/incubator_linux.go b/ssh/tailssh/incubator_linux.go index 2c531c475..67ed2ca19 100644 --- a/ssh/tailssh/incubator_linux.go +++ b/ssh/tailssh/incubator_linux.go @@ -173,3 +173,7 @@ func maybeStartLoginSessionLinux(logf logger.Logf, ia incubatorArgs) (func() err } return nil, nil } + +func (ia *incubatorArgs) loginArgs() []string { + return []string{ia.loginCmdPath, "-f", ia.localUser, "-h", ia.remoteIP, "-p"} +}