diff --git a/tool/tsh/main.go b/tool/tsh/main.go index 02b803d78495b..28141acf3fe19 100644 --- a/tool/tsh/main.go +++ b/tool/tsh/main.go @@ -16,14 +16,26 @@ limitations under the License. package main -import ( - "github.com/gravitational/teleport/tool/tsh/common" -) - import ( "os" + "path" + + "github.com/gravitational/teleport/tool/tsh/common" ) func main() { - common.Run(os.Args[1:], false) + cmd_line_orig := os.Args[1:] + cmd_line := []string{} + + // lets see: if the executable name is 'ssh' or 'scp' we convert + // that to "tsh ssh" or "tsh scp" + switch path.Base(os.Args[0]) { + case "ssh": + cmd_line = append([]string{"ssh"}, cmd_line_orig...) + case "scp": + cmd_line = append([]string{"scp"}, cmd_line_orig...) + default: + cmd_line = cmd_line_orig + } + common.Run(cmd_line, false) }