There are two mac hosts in my Wi-Fi network (laptop and Desktop) I'm trying to ssh laptop from Desktop - everything works fine When I'm trying to ssh from laptop to Desktop doing this:

ssh macpro.local

I get this:

ssh: Could not resolve hostname: nodename nor servname provided, or not known

defining usrename@macpro.local or root@macpro.local makes no difference

But when I do this:


it works.

As I said I have no problem doing all this on my desktop. Also when I do this (on both computers)

/usr/sbin/sshd -t

I get this:

Could not load host key: /etc/ssh_host_rsa_key
Could not load host key: /etc/ssh_host_dsa_key

Please help!


Fixed adding to /etc/hosts: macpro.local

For some reason ~/.ssh/config is not enough

| improve this answer | |

This message implies that you do not have sufficient filesystem permissions for the file containing your key. Use chmod 600 to set the rights correctly.

| improve this answer | |
  • thank you, I've already found this out... Kinda fixed my ssh connection (deleting all the keys and generating them from scrach), BUT when doing /usr/sbin/sshd -t still get this: Could not load host key: /etc/ssh_host_rsa_key Could not load host key: /etc/ssh_host_dsa_key interesting, that when I do sudo /usr/sbin/sshd -t I don't get any warnings... Could you explain why? And should I fix anything? – Drew Feb 19 '15 at 22:27
  • The system prevents you for starting sshd as standard user and using the systemwide hostkey. This is the reason why you did not get the message when using sudo. Sudo execute the followed command with admin rights. Then the sshd is able to use the hostkey from /etc. – ryder Feb 20 '15 at 9:03
  • 1
    I understand all this, but you didn't answer why and how to fix it. In fact I can ssh now as a standart user although I still have this messages... – Drew Feb 21 '15 at 2:13

The reason you get "Could not load host key" is probably because those files contain private keys and are protected. Try:

sudo /usr/sbin/sshd -t

As to lookups for macpro.localnot working, check sharing settings. Below the "Computer Name" field, it should tell you the name that other computers can access your desktop with. The "Edit" button lets you alter that.

| improve this answer | |
  • well on the desktop sudo /usr/sbin/sshd -t gives the same result, but on laptop I get that nice msg:@ WARNING: UNPROTECTED PRIVATE KEY FILE! @ What should I do with it??? And as to sharing settings - all is correct and should work, but it doesn't – Drew Feb 19 '15 at 2:45

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.