SSH Login with no password

By | December 11, 2014

How to log in using SSH with no password

ssh with no password

ssh with no password

I use SSH a lot and always find myself in need of a SSH login with no password all the time and so I decided to write how you go about doing this.

So say I am on host FOO as user A and I want to log into server BAR as user B without being asked for my password.

As a first step create a ssh key pair on host FOO by typing in the following in a terminal:

ssh-keygen -t rsa

Then create a directory .ssh in your home directory on the remote server BAR like this:

ssh B@BAR mkdir -p .ssh

Then copy over your ssh public key to the remote server like this:

cat .ssh/ | ssh B@BAR 'cat >> .ssh/authorized_keys'

From now on you can log into server BAR with:

ssh B@BAR

without being asked for a password.

Now I usually type:

ssh -X B@BAR

to make things even more easy I created the a script containing

ssh -X B@BAR

I named the script


and made it executable

chmod a+x ./gobar

And there you go! Now you can log into server BAR as user B just by typing gobar.


Leave a Reply

Your email address will not be published. Required fields are marked *