2

My issue is that I can't ssh agains the hostname, during troubleshooting I did a host look up and tried to ssh via IP which worked.

The error message I get is...

Permission denied (publickey).
ssh_exchange_identification: Connection closed by remote host

Which would describe a key mismatch which I was able to confirm matched by consoling into the sever directly. I had someone with access manually push the key to one server which seemed to resolve the issue however I need to access over 300 servers via ansible. My guess is git commit or whatever (super new with no clue :/) is having an issue. Any suggestions what could be the problem.

the output:

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/<user>/.ssh/config
debug1: /Users/<user>a/.ssh/config line 1: Applying options for *.<server>
debug1: /Users/<user>/.ssh/config line 13: Applying options for *.<server>
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 102: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket "/tmp/ssh-<user>@<server>:<port>" does not exist
debug2: ssh_connect: needpriv 0
debug1: Executing proxy command: exec ssh <proxy server name> nc -w 120 <server name> <port>
debug3: Incorrect RSA1 identifier
debug3: Could not load "/Users/<username>/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /Users/<username>/.ssh/id_rsa type 1
debug1: identity file /Users/<username>/.ssh/id_rsa-cert type -1
debug1: identity file /Users/<username>/.ssh/id_dsa type -1
debug1: identity file /Users/<username>/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: permanently_drop_suid: 501
debug1: Local version string SSH-2.0-OpenSSH_6.2
Permission denied (publickey).
ssh_exchange_identification: Connection closed by remote host

To provide an update, the issue doesn't seem to be related to my key after all. It seems to be related to my local system(mac OS 10.10.4) After my keys were properly pushed to the server contained in my ~/.ssh/config file I can SSH and connect to the servers in question. However I still cannot from local system. I can however SSH via IP, I believe this is a dns issue...maybe need to flush? FW is disabled.

ssh: connect to host port 3422: Connection refused

When I connect to one of the servers in question, my key matches what is located under ~/.ssh/authorized_key, in regards to GitHub, I add it there where in turn I BELIEVE gets pushed to all server via Ansible.

9
  • Please edit your question and add the output of hostaname and ifconfig Also are you using a "sudo" before the command?
    – David
    Sep 22, 2015 at 1:50
  • That error message has nothing to do with hostname, "Permission denied (publickey)." you need a key, talk to the sys admin
    – Panther
    Sep 22, 2015 at 3:00
  • could be for any number of reasons, see askubuntu.com/questions/311558/ssh-permission-denied-publickey and serverfault.com/questions/39733/…
    – Panther
    Sep 22, 2015 at 3:02
  • 1
    This is good stuff I appreciate all, will update ASAP. Thanks again...
    – cyv
    Sep 22, 2015 at 3:25
  • Disregard above comment I had a whitespace infront of hostname...still getting original error
    – cyv
    Sep 22, 2015 at 22:06

1 Answer 1

0

Ok, issue resolved....here's how:

  • Under the config file, my user name was all the way at the bottom, i.e..the last line

  • resolved by adding my username again under the first host declaration.

I am able to ssh to all the servers now

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .