For 3 days, I have been trying to set up a sFTP connection to upload a file to a client server.
I'm using this : https://gist.github.com/svett/b7f56afc966a6b6ac2fc
Only difference being that I added :
sshConfig := &ssh.ClientConfig{
User: "0000003579",
Auth: []ssh.AuthMethod{
//SSHAgent(),
PublicKeyFile("C:\\GoDev\\src\\Texel.ca\\Bnc_Ftp\\.ssh\\id_rsa"),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
HostKeyAlgorithms: []string{"ssh-dss"},
}
sshConfig.Ciphers = append(sshConfig.Ciphers, "aes128-cbc")
because my client server still use cbc and still use ssh-dss.
My issue :
When trying to connect, I get the following response:
Failed to dial: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
I tried to connect with the same credential via openSSH in a command line
ssh -oHostKeyAlgorithms=+ssh-dss ***@2XXX.XXX.XXX.XX -vvv
and it works.
Can I get more infos on my error like the -vvv command with openSSH? Or do any of you have an idea?
Thank you!
EDIT
Just for more information, there is a working tool right now that does the sftp transfert and it works.
But it's a .bat file that's why we are changing it to go.
It use WinSCP to connect to the sFTP with a rsa putty private key.
That might be one of the issue, as if I understand correctly, I can't use a puTTy private key with golang ssh package.
So I tried both the putty key and a conversion to openSSH, but both won't work.