SSH Permission Denied (PublicKey), Ubuntu 18.04

by bran   Last Updated October 10, 2019 04:02 AM

So I have read many questions and answers on this site. I have tried several answers, from changing settings in sshd_config, and having permissions set on private and public keys, 600 and 644 respectively.

I am working from a Windows 10 computer to a remote session on AWS, Ubuntu 18.04 I am not able to use ssh-copy-id because it does not work on windows. My keys were created on Ubuntu server ssh version 7.6. If I set PasswordAuthentication Yes I can get right in but I want to use Key Pair for remote access. I can provide any logs or Verb log in info you would need. I will give the last lines on log in attempt. and last lines of auth.log I used cat id_rsa.pub > authorized_keys to add new pub key to file

Any help would be greatly appreciated.

sshd_config LogLevel DEBUG PermitRootLogin without-password PubkeyAuthentication yes PasswordAuthentication no ChallengeResponseAuthentication no UsePAM yes Verb login OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 debug1: Connecting to 3.3.3.3 [3.3.3.3] port 22. debug1: Connection established. debug1: identity file ssh\\id_rsa type 0 debug1: key_load_public: No such file or directory debug1: identity file ssh\\id_rsa-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 pat OpenSSH* compat 0x04000000 debug1: Authenticating to 3.3.3.3:22 as '%USER%' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:UXjsxU5jYiKArcI0hg/GuVs7bkqPH+wXavh/rH70830 debug1: Host '3.3.3.3' is known and matches the ECDSA host key. debug1: Found key in C:\\Users\\PC19/.ssh/known_hosts:1 debug1: rekey after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: rekey after 134217728 blocks debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering public key: RSA SHA256:qltHGLIErARHSlQX7D63NsO/ZOzOdbWCEmG/NF5hOx8 ssh\\id_rsa debug1: Server accepts key: pkalg rsa-sha2-512 blen 279 debug1: read_passphrase: can't open /dev/tty: No such file or directory Enter passphrase for key 'ssh\id_rsa': identity_sign: private key ssh\\id_rsa contents do not match public debug1: No more authentication methods to try. %USER%@3.3.3.3: Permission denied (publickey). Debug Logs auth.log Oct 10 03:11:49 ip-172-31-25-81 sshd[25307]: debug1: Forked child 25329. Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: Set /proc/self/oom_score_adj to 0 Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8 Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: inetd sockets after dupping: 3, 3 Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: Connection from 6.137.179.131 port 39359 on 172.31.25.81 port 22 Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: Client protocol version 2.0; client software version OpenSSH_for_Windows_7.7 Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: match: OpenSSH_for_Windows_7.7 pat OpenSSH* compat 0x04000000 Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: permanently_set_uid: 109/65534 [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: list_hostkey_types: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: SSH2_MSG_KEXINIT sent [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: SSH2_MSG_KEXINIT received [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: kex: algorithm: curve25519-sha256 [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: kex: host key algorithm: ecdsa-sha2-nistp256 [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: rekey after 134217728 blocks [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: SSH2_MSG_NEWKEYS sent [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: expecting SSH2_MSG_NEWKEYS [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: SSH2_MSG_NEWKEYS received [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: rekey after 134217728 blocks [preauth] Oct 10 03:11:49 ip-172-31-25-81 sshd[25329]: debug1: KEX done [preauth] Oct 10 03:11:50 ip-172-31-25-81 sshd[25329]: debug1: userauth-request for user %USER% service ssh-connection method none [preauth] Oct 10 03:11:50 ip-172-31-25-81 sshd[25329]: debug1: attempt 0 failures 0 [preauth] Oct 10 03:11:50 ip-172-31-25-81 sshd[25329]: debug1: PAM: initializing for "%USER%" Oct 10 03:11:50 ip-172-31-25-81 sshd[25329]: debug1: PAM: setting PAM_RHOST to "6.137.179.131" Oct 10 03:11:50 ip-172-31-25-81 sshd[25329]: debug1: PAM: setting PAM_TTY to "ssh" Oct 10 03:11:50 ip-172-31-25-81 sshd[25329]: Connection reset by authenticating user %USER% 6.137.179.131 port 39359 [preauth] Oct 10 03:11:50 ip-172-31-25-81 sshd[25329]: debug1: do_cleanup [preauth] Oct 10 03:11:50 ip-172-31-25-81 sshd[25329]: debug1: monitor_read_log: child log fd closed Oct 10 03:11:50 ip-172-31-25-81 sshd[25329]: debug1: do_cleanup Oct 10 03:11:50 ip-172-31-25-81 sshd[25329]: debug1: PAM: cleanup Oct 10 03:11:50 ip-172-31-25-81 sshd[25329]: debug1: Killing privsep child 25330 Oct 10 03:11:50 ip-172-31-25-81 sshd[25329]: debug1: audit_event: unhandled event 12

Tags : 18.04 ssh openssh


Related Questions


Updated August 30, 2015 00:01 AM

Updated April 03, 2016 09:00 AM

Updated September 16, 2015 15:01 PM

Updated September 27, 2016 09:00 AM

Updated October 07, 2016 10:00 AM