DEV Community

loading...

Copy SSH Keys to Server

scottrobertson profile image Scott Robertson Originally published at blog.scottrobertson.me on ・1 min read

When you wish to log in to a server without having to enter a password, all you need to do is log in with SSH. However I do not know why, but it took me hours to find a simple way to do this a few years ago.

First of all, you need to generate your SSH keys using the following:

ssh-keygen
Enter fullscreen mode Exit fullscreen mode

From this point, I generally just hit enter and use the defaults. You can set a password, but that can get annoying.

Now you need to copy the SSH keys to the server you wish to log in to. I have found many ways to do this, but none have been as simple as the following:

ssh-copy-id username@server.com
Enter fullscreen mode Exit fullscreen mode

You will then be asked for your password for the last time. Once this has complete, you will be able to login to the server using just:

ssh username@server.com
Enter fullscreen mode Exit fullscreen mode

Discussion (0)

pic
Editor guide