SSH passwordless connection on Yosemite

Hi, I'm trying to set up a SSH connection between my local Mac OS X with El Capitan and a remote computer which runs OS X Yosemite. However I'm experiencing some issue when making the connection passwordless. I noticed that on Yosemite, the folder ~/.ssh/ does not exist (cause maybe it should be created?) though there is /var/root/.ssh/ . I've tried to copy the content of my id_rsa.pub to Yosemite' folder /var/root/.ssh inside authorized_keys but still it gives me "Permission denied (public key)". Pretty sure to have set up sshd_config properly as well. Should I move to ~/.ssh instead?

Posted on Nov 26, 2015 1:23 AM

Reply
1 reply

Nov 26, 2015 7:17 AM in response to Afri61

In a new user account that has never used ssh before or at least never used an RSA key with ssh before you likely will not have a .ssh directory. You may need to create it or the ssh-keygen may do it for you.


To do a passwordless SSH session you do need to create a pair of RSA keys using ssh_keygen in ~/.ssh/ and you then need to copy the public one to the other machine - the one you want to connect to. You need to append it to the authorized_keys file in the .ssh folder of the user account you are connecting to on that remote machine. So if you will be doing -


ssh fred@remotemachine


Then you append your public key i.e. your id_rsa.pub to >> authorized_keys here is an example command showing how to use scp to transfer your id_rsa.pub


cat ~/.ssh/id_rsa.pub | ssh fred@remotemachine 'cat >> ~/.ssh/authorized_keys'

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 passwordless connection on Yosemite

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