diff --git a/cli/cli.go b/cli/cli.go index 4da1087..10a86de 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -135,6 +135,7 @@ func New(cfg *config.XCConfig, backend store.Backend) (*Cli, error) { remote.SetDebug(cli.debug) remote.SetUsePasswordManager(cli.usePasswordMgr) remote.SetNumThreads(cli.sshThreads) + remote.SetSSHCommand(cfg.SSHCommand) remote.SetRemoteEnvironment(cfg.RemoteEnvironment) // interpreter diff --git a/config/config.go b/config/config.go index dede5d2..a9bd9ad 100644 --- a/config/config.go +++ b/config/config.go @@ -27,6 +27,7 @@ distribute = tar [executer] ssh_threads = 50 ssh_connect_timeout = 1 +ssh_command = /usr/bin/ssh progress_bar = true prepend_hostnames = true remote_tmpdir = /tmp @@ -70,6 +71,7 @@ type XCConfig struct { User string SSHThreads int SSHConnectTimeout int + SSHCommand string PingCount int RemoteTmpdir string Mode string @@ -109,6 +111,7 @@ const ( defaultProgressbar = true defaultPrependHostnames = true defaultSSHConnectTimeout = 1 + defaultSSHCommand = "/usr/bin/ssh" defaultLogFile = "" defaultExitConfirm = true defaultExecConfirm = true @@ -208,6 +211,12 @@ func read(filename string, secondPass bool) (*XCConfig, error) { } cfg.SSHThreads = threads + sshCommand, err := props.GetString("executer.ssh_command") + if err != nil { + sshCommand = defaultSSHCommand + } + cfg.SSHCommand = sshCommand + ctimeout, err := props.GetInt("executer.ssh_connect_timeout") if err != nil { ctimeout = defaultSSHConnectTimeout diff --git a/remote/commands.go b/remote/commands.go index df4cf24..5fafc9f 100644 --- a/remote/commands.go +++ b/remote/commands.go @@ -60,7 +60,7 @@ func createSSHCmd(host string, argv string) *exec.Cmd { params = append(params, "-c", argv) } log.Debugf("Created command ssh %v", params) - return exec.Command("ssh", params...) + return exec.Command(sshCommand, params...) } func getInterpreter() []string { diff --git a/remote/remote.go b/remote/remote.go index ea7e612..8e887fc 100644 --- a/remote/remote.go +++ b/remote/remote.go @@ -25,6 +25,7 @@ var ( poolLock *sync.Mutex poolSize int remoteEnvironment map[string]string + sshCommand string noneInterpreter string suInterpreter string @@ -39,6 +40,11 @@ func Initialize(numThreads int, username string) { SetRaise(RTNone) } +// SetSSHCommand sets ssh binary path to be used in createSSHCommand +func SetSSHCommand(command string) { + sshCommand = command +} + // SetInterpreter sets none-raise interpreter func SetInterpreter(interpreter string) { noneInterpreter = interpreter