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.

5 Comments

  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/id_rsa.pub user@server:~/.ssh/authorized_keys
    (From http://forum.slicehost.com/comments.php?DiscussionID=990)

    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 😉

    Lee

    Friday, September 11, 2009 at 11:20 | Permalink | Using Safari Safari 531.9 on Mac OS X Mac OS X 10.6
  2. jon wrote:

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

    scp .ssh/id_dsa.pub daniel@linuxtwo:

    cat id_dsa.pub >> .ssh/authorized_keys

    See:

    Howto setup SSH keys between machines

    http://fedoranews.org/dowen/sshkeys/

    Tuesday, September 29, 2009 at 18:12 | Permalink | Using Safari Safari 531.9 on Mac OS X Mac OS X 10.4.11
  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 | Using Mozilla Firefox Mozilla Firefox 3.5.4 on Mac OS X Mac OS X 10
  4. Peter wrote:

    Alan,

    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 | Using Mozilla Firefox Mozilla Firefox 3.5.5 on Mac OS X Mac OS X 10
  5. Michael wrote:

    Peter,

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

    Michael

    Saturday, February 27, 2010 at 06:02 | Permalink | Using Safari Safari 531.21.10 on Mac OS X Mac OS X 10.5.8

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 — usually your comment will appear straight away but sometimes it will be held for approval (this is due to the spam filter). If your comment is waiting to be approved, please don’t post it again! It will appear eventually.