Skip to content

Set Up Public Key Authentication for SSH on the Mac

Thanks to a great suggestion by Nick Charlton, I decided to put together a screencast demonstrating how to set up public key authentication for logging into SSH servers on the Mac.

Setting up a keypair and then using it to log in to remote systems, instead of remembering separate usernames and passwords, can be a bit of a fiddly business, but I hope that in this screencast I can show how to get it set up.

Set Up Public Key Authentication for SSH on the Mac from Peter Upfold on Vimeo.

Take a look and let me know what you think!

Find this tutorial useful?

Like this post?

If you would like to support the time and effort I have put into my tutorials and writing, please consider making a donation.


  1. Lee Findlow wrote:

    This is something which I was trying to figure out a while ago, in order for automated rsync backups. It is essentially quite a simple thing I suppose, although there are so many different tutorials on it I ended up getting quite confused. In the end I got it working in a bodged up way, although one noticeable difference I found was to use the following command:

    scp ~/.ssh/ user@server:~/.ssh/authorized_keys

    In order to copy my public key across … but the problem with that is that it will clear out any other keys in there, but great tutorial! Will definitely use it for reference in the future (as I tend to forget these things 😉


    Friday, September 11, 2009 at 11:20 | Permalink |
  2. jon wrote:

    The scp issue can be solved by using the following commands:

    scp .ssh/ daniel@linuxtwo:

    cat >> .ssh/authorized_keys


    Howto setup SSH keys between machines

    Tuesday, September 29, 2009 at 18:12 | Permalink |
  3. Alan Paterson wrote:

    Great stuff. A very great help – except…

    I need to log on to VMS machines. I DO have on my PC this stuff set up and working (using Pageant and PuTTy) so I know that it should be possible. Following from what you describe here I did try creating the file sys$login:[ssh]authorized_keys with the contents of the public key. But no luck.

    Any suggestions anyone?

    Friday, November 6, 2009 at 09:13 | Permalink |
  4. Peter wrote:


    I don’t know anything about VMS or how that might differ from my server in this example (CentOS Linux), but you might try double-checking the permissions on everything to do with the SSH server on that machine. If one thing is slightly differing from the required permissions, logging on via a key will simply fail.

    Friday, November 6, 2009 at 11:47 | Permalink |
  5. Michael wrote:


    Thanks for the great tutorial!! Your youtube video helped me out alot.


    Saturday, February 27, 2010 at 06:02 | Permalink |

Post a Comment

On some sites, you must be logged in to post a comment. This is not the case on this site.
Your email address is not made public or shared. Required fields are marked with *.

Posting a comment signifies you accept the privacy policy.
Please note — your comment will not appear straight away, as all comments are held for approval.