ssh into osx with pub key (i.e. without password)

I am on a remote system (RHEL 7) and I need access to my mac (10.13.6). I cannot get it working using public keys. I can go the other way, from my mac into the remote system, but when I've tried to get from the remote into the Mac, it keeps asking me for my password. This is what I've done, I'd expect it to work, but it doesn't:


From my remote, I've done this:
ssh-copy-id myuser@my.osxaddress.com

In my mac I can see that the remote public key does in fact exist in:

~/.ssh/authorized_keys


And in my config:

/etc/ssh/sshd_config

I've set:
PubkeyAuthentication yes

Alas, still no joy. 😢

Am I missing something? Password authentication works, so clearly I can login from the remote, and the key in the mac's authorized_keys and the remote's id_rsa.pub match, so what gives?

MacBook Pro, macOS High Sierra (10.13.6)

Posted on Aug 29, 2018 5:05 PM

Reply

Similar questions

1 reply

Aug 30, 2018 5:58 AM in response to boarddrone

It worked for me as follows.


On the client Mac i.e. the one I want to use to control the 'server' I used the following command to copy the ssh public key


cat ~/.ssh/id_rsa.pub | ssh <user>@<hostname> 'cat >> .ssh/authorized_keys && echo "Key copied"'


This assumes the /Users/<user>/.ssh folder exists otherwise you will get an error. The above command will ask for the password for the <user> account to authorise the transfer.


I then connected from the client Mac to the server using


ssh <user>@<hostname>


This time I was not asked for a password showing it worked. The 'server' was a Mac mini running High Sierra.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

ssh into osx with pub key (i.e. without password)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.