Michael Crosby

Setup Password-less Login over SSH

Everyone needs a fast instance in a datacenter to work with. Amazon's EC2 or any other VPS provider will give you access. Sometimes you need to transfer files around fast or do some data processing. Having a fast instance will help you get your job done faster.

I have a tutorial that I needed to upload to an FTP server and do an FXP copy. The file is resting on another FTP server form a basic hosting provider. I do not have FXP access. So I launched an instance on EC2. Logged in via ssh. wget the file from my hosting server. Then connected to the marketplace FTP and uploaded the file. Easy, fast, and all the transferring was done on someone else's bandwidth.

To make this easier here is how to setup ssh to use a ssh key file instead of a password. This has more advantages than just making it quicker to ssh into my instances. You can use this to setup automated backups using rsync.

How To:

On your local machine you need to jump into terminal for this. Go to your home dir and make a new .ssh folder if it does not exist. To see if it does exist just type:

ls -a

If not exist then:

mkdir .ssh

Now cd into it:

cd .ssh

Now we need to generate an rsa key file:

ssh-keygen -t rsa

Do not enter a passphrase, just leave it blank.

Now you need to ssh into your instance or remote computer and make an .ssh folder in your user home folder. Same as above.

Now cd into and make a new file called:


In this file, paste the contents of your local computers newly generated id_rsa.pub file into it.

Now, still on your remote computer or instance, you need to change the permission of the authorized_keys file to 644:

chmod 644 authorized_keys

All done. Exit your ssh session and login again and you will notice that you don't have to enter a password now.

I suggest changing your password to something really long and secure since you won't be using it anymore, unless logging into to it from a different computer.

comments powered by Disqus