From 59c2c028c89aefcc593696b17bb7e9e0b5d99196 Mon Sep 17 00:00:00 2001 From: Andrew Woodlee Date: Mon, 2 Jan 2023 13:29:12 -0600 Subject: [PATCH] add ssh timeout --- pkg/backy/ssh.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/backy/ssh.go b/pkg/backy/ssh.go index 3c69f9f..fbb7ace 100644 --- a/pkg/backy/ssh.go +++ b/pkg/backy/ssh.go @@ -9,6 +9,7 @@ import ( "os/user" "path/filepath" "strings" + "time" "github.com/kevinburke/ssh_config" "golang.org/x/crypto/ssh" @@ -106,6 +107,7 @@ func (remoteConfig *Host) ConnectToSSHHost() (*ssh.Client, error) { User: remoteConfig.User, Auth: []ssh.AuthMethod{ssh.PublicKeys(signer)}, HostKeyCallback: ssh.FixedHostKey(hostKey), + Timeout: 5 * time.Second, } for _, host := range remoteConfig.HostName { println("Connecting to " + host)