diff options
| author | Jeff Carr <[email protected]> | 2019-06-13 20:26:04 -0700 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2019-06-13 20:26:04 -0700 |
| commit | db4ffc0fa9ae0d032c05f3e3ac4dc0af4a48db8f (patch) | |
| tree | 3743bc1abfbada2c2cdd98e2113651ee161e73f4 /ssh.go | |
| parent | 49d36e287d983f72b2b2b5d903fb3bf55a44b440 (diff) | |
more ssh tests
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'ssh.go')
| -rw-r--r-- | ssh.go | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -9,6 +9,7 @@ import "io/ioutil" import "path/filepath" import "strings" import "time" +import "runtime" import "golang.org/x/crypto/ssh" import "github.com/tmc/scp" @@ -24,7 +25,17 @@ func SSH(hostname string, port int, username string, pass string) *ssh.Session { user, _ := user.Current() - publicKey, err := PublicKeyFile(user.HomeDir + "/.ssh/id_ed25519") + keyfile := user.HomeDir + "/.ssh/id_ed25519" + if runtime.GOOS == "windows" { + if Exists("/cygwin") { + log.Println("On Windows, but running within cygwin") + keyfile = "/home/wit/.ssh/id_ed25519" + } else { + keyfile = user.HomeDir + "\\id_ed25519" + } + } + + publicKey, err := PublicKeyFile(keyfile) if (err != nil) { log.Println("PublicKeyFile() error =", err) } |
