Permission denied (publickey) when sshing

As the title says, I started getting the Permission denied (publickey) error today. I was able to log in this morning before this started no problem and this seems to have started happening after I synced some files I was going to be working on. None of the files I synced dealt with server configuration or the authenticated keys on the server, they are files written in PHP that are specific to the web application I'm working on. I've been able to ssh into my Ubuntu server for over a year and something happened today where I keep getting the Permission denied (publickey). error when I try to ssh in. I tried copying my public key again with ssh-copy-id, but get an error saying

Received disconnect from 172.16.55.102 port 22:2: Too many authentication failures

I understand that there must have been connection failures from my main computer to my server, but I'm not sure what to do about this error either. I haven't changed any configuration on my server or removed anything from the authenticated keys (that I know of).

I made sure my config file uses IdentityFile and made sure the key exists so it doesn't keep trying different keys to log in.

I don't have another way of getting into the server and the infrastructure guy who set it up is no longer working at the company I'm with. Is there another way of solving this?

EDIT: Here is the output when I run ssh -vvvv

debug1: Reading configuration data /home/dev123/.ssh/config
debug1: /home/dev123/.ssh/config line 2: Applying options for 172.16.55.*
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "172.16.55.102" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 172.16.55.102 [172.16.55.102] port 22.
debug1: Connection established.
debug1: identity file /home/dev123/.ssh/App_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/dev123/.ssh/App_rsa-cert type -1
debug1: identity file /home/dev123/.ssh/App_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/dev123/.ssh/App_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1
debug1: match: OpenSSH_7.6p1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 172.16.55.102:22 as 'dev123'
debug3: hostkeys_foreach: reading file "/home/dev123/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/dev123/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from 172.16.55.102
debug3: order_hostkeyalgs: prefer hostkeyalgs: ,,,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: ,,,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,,,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: ,aes128-ctr,aes192-ctr,aes256-ctr,,
debug2: ciphers stoc: ,aes128-ctr,aes192-ctr,aes256-ctr,,
debug2: MACs ctos: ,,,,,,,hmac-sha2-256,hmac-sha2-512,hmac-sha1debug2: MACs stoc: ,,,,,,,hmac-sha2-256,hmac-sha2-512,hmac-sha1debug2: compression ctos: none,,zlib
debug2: compression stoc: none,,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: ,diffie-hellman-group-exchange-sha256
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: ,,,aes256-ctr,aes192-ctr,aes128-ctr
debug2: ciphers stoc: ,,,aes256-ctr,aes192-ctr,aes128-ctr
debug2: MACs ctos: ,,,hmac-sha2-512,hmac-sha2-256
debug2: MACs stoc: ,,,hmac-sha2-512,hmac-sha2-256
debug2: compression ctos: none,
debug2: compression stoc: none,
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm:
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: MAC: <implicit> compression: none
debug1: kex: client->server cipher: MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:mqOXsQayorR2q5TwY86GuZCuFyKNndx1LKByjDmf/Zk
debug3: hostkeys_foreach: reading file "/home/dev123/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/dev123/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from 172.16.55.102
debug1: Host '172.16.55.102' is known and matches the ECDSA host key.
debug1: Found key in /home/dev123/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug2: key: /home/dev123/.ssh/App_rsa (0x55c5a86eb7a0), explicit
debug2: key: /home/dev123/.ssh/App_rsa (0x55c5a86ebb90), explicit
debug3: send packet: type 5
debug3: receive packet: type 7
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>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 53
debug3: input_userauth_banner
12

1 Answer

I wanted to answer my question for anyone who might stumble on this post in the future. The issue ended up being that my .ssh directory on my server somehow got corrupted or erased during a file syncing script I ran. I'm still not totally sure exactly how and wasn't able to determine anything that went wrong that day from the logs. Thankfully, the lead developer at the company I work at has an account on my server as well and was able to put my public key back where it needed to be and reset my login attempt and now I'm able to get on again. Presumably, the reason I would get the "too many authentication failures" message was from attempting to ssh in when the key didn't exist on my server and then blocked my account.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like