Wednesday, 29 January 2014

How to: Create Passwordless SSH Remote Login

The intention is simple: just let me in without asking for password again and again!

Follow the steps to achieve this:

1. Generate RSA key from host machine (skip this if you have already got one)

ssh-keygen -t rsa -C <youremail@email.com>

Accept the default location and DO NOT give a password to it.

2. Copy the RSA key generated to your remote machine

cat ~/.ssh/id_rsa.pub | ssh root@<remotemachineipaddress> 'cat >> ~/.ssh/authorized_keys'

So far, it is all done.

3. A step further

It would be great if can we save the time on typing the hideous 'SSH' and 'blarblar@blar.blar.blar.blar' as well, wouldn't it? Set up an alias for it from your host machine then.

alias apple='ssh root@<remotemachineipaddress>'

Put the line into '~/.bashrc' so that it would persist.

And there we go, apple is your new login!

No comments:

Post a Comment