How to create SSH Keys for your VPS

 VPS Hosting

This article will show you how to create SSH keys on your PC for vps hosting and connect them to your vps host. SSH Keys are used to identify your system (or ssh client) with your server to allow for passwordless and highly secure logins to better secure your vps. For this example, I will be using the command line version of openssh. OpenSSH is built into most Linux and OSX system’s terminals and after 2019 is built into Windows 10 through the command prompt (to test, run ssh in command prompt). You can later import these keys into programs like PuTTY, FileZilla, and WinSCP.

Make sure you can SSH into your server with the password you created when you bought it. Do this by typing ssh root@ip-or-domain and then proceeding to login. You can then close the connection by entering exit in the terminal.

Generate yourself a key pair the ssh-keygen command. You can just save it in the default location if it asks. If you plan to send your SSH key to other devices set a password for best security. It will then be saved and you can use it

Set up the key on the server by running ssh-copy-id username@ipaddressIf that doesn’t work on OSX or Linux you can usecat ~/.ssh/ | ssh username@ip-address “cat >> ~/.ssh/authorized_keys” If you want to do it on windows you may want to use one of the scripts found here Once promoted, put in your password to add the key. You may notice that I have a lot of security warnings and that is because I use my domain for lots of VPS testing so the fingerprint ID changes. You can prevent this by using the IP address instead of the domain.

Test and connect by entering in ssh username@server-adderess then seeing if it asks for your id_rsa file password instead of password for user. Depending on your system’s password security policy and if you set a password on your key in the beginning will determine if you need to re-enter the password when you login. Sometimes on certain systems after installing the key you will never have to enter a password again!

If you require any further help or still have questions then contact us!

Was this article helpful?

Sign up to be alerted of new articles!

We will let you know of any new articles that we publish so that you may benefit from the many upcoming tutorials we have planned for you.