How to login to ssh using public key authentication

First you have to create a public, private key pair. For this you can use the command-line tool sshkey-gen.

Change the directory to “~/.ssh” (create it, if it does not exist).
cd ~/.ssh

Create key pair
Now let’s create the key pair. In this example I will use RSA with 4096 Bit
ssh-keygen -t rsa -b 4096

Enter a passphrase if you want but you don’t have to. I recommend to enter a passphrase.

Transfer public key to ssh server
To transfer the public key to the ssh server you can use ssh-copy-id.
ssh-copy-id -i ~/.ssh/ HOST

Login with key
Now you should be able to login with the created key.


Posted on April 19, 2012, in Network, SSH and tagged , . Bookmark the permalink. Leave a comment.

Leave a Reply

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

You are commenting using your 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

%d bloggers like this: