3

I am having a hard time understanding the output from the command below. I am trying to connect to a godaddy server and have been unsuccessful. I enabled SSH access on godaddy's cpanel, created a public/private key, downloaded the private key, moved it into ~/.ssh and added the key to the keychain using ssh-add -K ~/.ssh/mykey. I am unable to connect. I know there is another question on this site but I am providing actual output and want to know the reason it's failing.

I am not sure why it's not looking for SSH key called key4govi (that's what my private key is called. It seems to be looking at they key id_rsa(assuming from the output).

Here are my folder contents for the .ssh folder on my local machine:

github_rsa              
github_rsa.pub      
id_rsa
id_rsa.pub
key4govi
key4govi.pub
known_hosts

Here's my command: ~ => ssh [email protected] -vv

Here's the output:

OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: /etc/ssh/ssh_config line 53: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to callydai.com [107.180.55.15] port 22.
debug1: Connection established.
debug1: identity file /Users/raigovind93/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raigovind93/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raigovind93/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raigovind93/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raigovind93/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raigovind93/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raigovind93/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raigovind93/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
ssh_exchange_identification: read: Connection reset by peer
1
  • 1
    we are not blind, please don't use this kind of big bold text Commented Feb 5, 2017 at 4:36

5 Answers 5

0
ssh_exchange_identification: read: Connection reset by peer

points out to different error. It means that you were able to connect to ssh server but the connection was closed immediately without getting correct "hello" message. Is the server running there? Isn't there some kind of policy where from you can connect? Do you have correct reverse DNS record?

Your key is correctly in keychain and once you would be able to connect to the correct key will be offered. The other keys touched are default paths and ssh will try to open them always.

3
  • I see. the server is running because callydai.com defintiely works, the reverse DNS record is correct as well. Could you elaborate what you mean by policy? It honestly seems ssh connections are being blocked..
    – Govind Rai
    Commented Feb 5, 2017 at 8:15
  • I am not talking about godady server, but ssh server. The policy in your provider can somehow block the connection, both the policy on their side. You would have to talk to godady about that. Or have a look into the server log if you have access to something like that.
    – Jakuje
    Commented Feb 5, 2017 at 8:16
  • Ah of course. my bad. I have no way of accessing the mainframe so I can't actually type any commands. The only thing I can rely on is the cpanel gui where I click SSH and hit enable SSH and I have clicked it just now again, but still getting the same error. The godaddy filesystem doesn't have sshd or ssh error logs... I will have to contact them
    – Govind Rai
    Commented Feb 5, 2017 at 8:18
0

A late answer, but it seems to me that although you may have loaded the key to the agent/keychain, the SSH client does not seem to be attempting to use the agent at all.

The meaning of the -K option to ssh-add varies between different OpenSSH versions. The fact that you mentioned the word "keychain" suggests you might be familiar with a MacOS customized version of ssh-add, and the option would seem to make sense with it.

On a vanilla OpenSSH (version 8.4), the -K option now loads keys from a FIDO authenticator, so the client operating system version might be important here.

Things to check in this situation would be:

  • Basic sanity check: Does the SSH_AUTH_SOCK environment variable exist? Does it point to a valid UNIX socket? fuser $SSH_AUTH_SOCK should reveal the PID of a ssh-agent process that is owned by your user account and is part of your current login session.

  • You said you ran ssh-add -K ~/.ssh/mykey but the name of the actual private key file is ~/.ssh/key4govi. I assume this was just a mistake in writing the question, and you actually ran ssh-add -K ~/.ssh/key4govi... right?

  • Was the ~/.ssh/key4govi file properly protected? man ssh-add says (emphasis mine):

Identity files should not be readable by anyone but the user. Note that ssh-add ignores identity files if they are accessible to others.

If ~/.ssh/key4govi did have permissions more relaxed than -rw-------, then it might have been ignored, and so your ssh-add command may not have done anything at all.

  • Do you have some custom configuration in ~/.ssh/config that would stop the use of the SSH agent/keychain unless explicitly allowed?
0

I specify the key in the .ssh/config file. The config file is your friend.

Host some-name
    # The actual host name or IP address of the server
    HostName xxx.xxx.xxx.xx
    User username
    IdentityFile ~/.ssh/some-key-edcsa

Then when you type ssh some-name it will try using the key that you associated with that name.

-1

You need to add your client's public key in the server's authorized keys. So you append the contents of client:~/.ssh/id_rsa.pub into server:~/.ssh/authorized_keys.

3
  • Hi Julie, I have done that but I am still getting the same error.
    – Govind Rai
    Commented Feb 5, 2017 at 6:21
  • From server, ls -l ~/.ssh/authorized_keys? Commented Feb 5, 2017 at 6:56
  • unfortunately I don't have access to the the mainframe from the godaddy website, but I do have access to the cpanel interface. The authorized_keys file is definitely there in the .ssh folder. it has a permission of 644. and like instructed, I copied the id_rsa.pub from my computer to the authorized_keys file on the server.
    – Govind Rai
    Commented Feb 5, 2017 at 7:13
-1

Maybe you can try this command

ssh-copy-id -i identity-file(ex.id_rsa.pub) user@server

You will be asked to enter the password for the account, that means, PasswordAuthentication yes must be set.

The command creates the needed entry in .ssh/authorized_keys. So after that you should be able to connect to the server via ssh -i identity-file user@server

0

You must log in to answer this question.

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