ssh handshake failed

3,308 views
Skip to first unread message

blia....@gmail.com

unread,
Nov 5, 2014, 12:16:36 PM11/5/14
to golan...@googlegroups.com
Hi all, I'm trying to write a simple ssh script and I'm seeing constant failure with: Failed to dial: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain.

I'm using the given example from the docs (code.google.com/p/go.crypto/ssh) and adding in a username and password that I know works. I'm using go1.3.3 on Mac OSX 10.8. 

I've tried running this against Mac and Linux and seeing the same failure. On Linux, I have OpenSSH installed.

I know that there are some issues with the supporting ciphers but I just don't know what's causing it. This is my config, I've added the ciphers. I don't know if thats helping or making it worst.

config := &ssh.ClientConfig{
User: "admin",
Auth: []ssh.AuthMethod{
ssh.Password("password"),
},
Config: ssh.Config{
Ciphers: []string{"aes128-ctr", "aes192-ctr", "aes256-ctr", "arcfour256", "arcfour128", "aes128-cbc", "3des-cbc", "blowfish-cbc", "cast128-cbc", "aes192-cbc", "aes256-cbc", "arcfour"},
},
}

Any help, suggestions is appreciative. Thanks in advance!

Shawn Milochik

unread,
Nov 5, 2014, 6:23:58 PM11/5/14
to golan...@googlegroups.com
I just did this and it works:
So does this:

I don't see what you're doing wrong, I'm not populating ClientConfig.Config and it works without it (both with private key auth and password authentication). So maybe try just dropping that.


Lars Seipel

unread,
Nov 5, 2014, 6:30:17 PM11/5/14
to blia....@gmail.com, golan...@googlegroups.com
On Wed, Nov 05, 2014 at 09:16:36AM -0800, blia....@gmail.com wrote:
> Hi all, I'm trying to write a simple ssh script and I'm seeing constant
> failure with: *Failed to dial: ssh: handshake failed: ssh: unable to
> authenticate, attempted methods [none], no supported methods remain.*

My guess would be that your sshd does not enable password authentication
but only keyboard-interactive. Take a look at ssh.KeyboardInteractive.
It should return an appropriate ssh.AuthMethod. Or, better yet, use
public-key-based auth.

You could also change your sshd's configuration to allow
PasswordAuthentication.

Lars

Lars Seipel

unread,
Nov 5, 2014, 6:41:21 PM11/5/14
to blia....@gmail.com, golan...@googlegroups.com
On Thu, Nov 06, 2014 at 12:30:00AM +0100, Lars Seipel wrote:
> My guess would be that your sshd does not enable password authentication
> but only keyboard-interactive.

Addendum: to verify this, you might try to restrict OpenSSH's client to
using password auth only.

% ssh -oPreferredAuthentications=password user@host

If that works, my guess would be false. If it doesn't and prints
something like "Permission denied (publickey,keyboard-interactive)"
instead, see my last mail on what you can do.

Lars

Blia Xiong

unread,
Nov 5, 2014, 6:47:00 PM11/5/14
to Lars Seipel, golan...@googlegroups.com
I did manage to get Public Key to work. I'll have to go and play with the configurations some more and see. For the moment, it looks like a bug but very unlikely.

Thanks for the input.
--
Thanks!

Blia Xiong

Blia Xiong

unread,
Nov 6, 2014, 10:39:47 AM11/6/14
to Lars Seipel, golan...@googlegroups.com
So I did some more testing and configured SSHd and set PasswordAuthentication yes. On one of the machines, running % ssh -oPreferredAuthentications=password user@host resulted in Permission denied (publickey,keyboard-interactive). The other one worked with password authentication. 

It now works. Appreciate the help!
Reply all
Reply to author
Forward
0 new messages