Using SSH Keygen not able to connect to server on

2019-06-09 16:32发布

问题:

I'm following below tutorial.

https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2

It's generated file on Windows 10 C:\Users\<user name>\.ssh

I'm using GIT to generate files.

 ~/Desktop
$ PermitRootLogin without-password
bash: PermitRootLogin: command not found

$ ssh a@b.com
a@b.com's password:
Permission denied, please try again.

I have generated .ppk file using puttygen.exe.
Still not able to connect to server.

By doing ssh -Tv a@b.com

It will give below response

OpenSSH_7.1p2, OpenSSL 1.0.2h  3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to a@b.com [XXX.XXX.XXX.XX] port 22.
debug1: Connection established.
debug1: identity file /c/Users/XUser/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to a@b.com:22 as 'XUser'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:WrjAO7ldoJ3vjYENd6v7JvxXkbquvvom16RYGKeRO70
debug1: Host 'a@b.com' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/XUser/.ssh/known_hosts:2
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/XUser/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /c/Users/XUser/.ssh/id_dsa
debug1: Trying private key: /c/Users/XUser/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/XUser/.ssh/id_ed25519
debug1: Next authentication method: password
XUser@a@b.com's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
XUser@a@b.com's password:

回答1:

If you do have

  • your public key: C:\Users\<user name>\.ssh\id_rsa.pub
  • your private key: C:\Users\<user name>\.ssh\id_rsa

Do copy your public key (see "How To Use SSH Keys with DigitalOcean Droplets")