projectz

Tech, Gadgets, Photography, Social Media and Poor Spelling

How to Set Up a Password-less SSH Login

How to Set Up a Password-less SSH Login
Set up password-less SSH logins

Setting up passwordless SSH logins is a great way to speed up connections to regularly accessedremote Macs and unix boxes. Because OS X doesn’t include the ssh-copy-id command, you will have to use cat or scp to copy over your ssh key. This is how to set everything up, it only takes a minute or so.

First, on the local machine you will want to generate a secure SSH key:

ssh-keygen

Walk through the key generator and set a password, the key file by default goes into ~/.ssh/id_rsa

Next, you need to copy the generated key to the remote server you want to setup passwordless logins with, this is easily done with the following command string but you can use scp if you’d prefer:

cat ~/.ssh/id_dsa.pub | ssh user@remotehost 'cat >> ~/.ssh/authorized_keys'

This command takes the generated SSH key from the local machine, connects to the remote host via SSH, and then uses cat to append the key file to the remote users authorized key list. Because this connects with SSH to the remote machine you will need to enter the password to use this command.

Finally, confirm that you can now login to the remote SSH server without a password:

ssh user@remotehost.com

Assuming initial setup went as intended, you will connect to the remote machine without having to log in. You can shorten the connection steps even further by creating an alias in bash_profile so that you are only required to type a short command to immediately connect to the specified remote server.

There are some obvious potential security risks with using ssh without a password, the best way to mitigate that is to lock down the client machine with lock screens for screen savers and sleep andboot passwords, all of which you should be utilizing anyway.

Advertisements

One comment on “How to Set Up a Password-less SSH Login

  1. Darious Clay
    January 9, 2013

    I agree logging into the remote SSH server without a password is risky business.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on May 27, 2012 by in link and tagged , , , , , , .
%d bloggers like this: