How To Set Up SSH Keys To Allow Access To Instances
We’re helping customers to increase the security of their F2H instances in a number of ways. First, we disable the root account on all instances by default. Next, during instance install and reinstall we configure a user account. Finally, customers can also choose to use an SSH key to access their instance. We’re going to set up ssh keys and use these keys to access instances without a password. This guide covers how to provide your SSH key in the Discovery control panel which will be installed when you reinstall your instance. And also how to set up ssh keys and add your SSH keys to an already running instance.
Generate An SSH Keypair
SSH keys consist of a public key and a private key. You give out the public ssh key and keep the private ssh key secure. We advise you to store your SSH keys in an external USB key or a service like Onedrive where you can sync the key over multiple devices. Do not lose your private ssh key. If you do, you could lose access to your instance. To generate your keypair. Login to your server and issue the ssh-keygen command.
ssh-keygen -t rsa
You will now be asked a number of questions;
- Enter file in which to save the key (/root/.ssh/id_rsa)
- Press enter to store the keypaid at the default location
- Enter passphrase (empty for no passphrase)
- If you want to enter a password each time you use your key. Enter it now.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:MXLkhd/TKyX89UB4TmM6iXLaAKvILFNsFb1ZhipNuJM [email protected]
The key's randomart image is:
+---[RSA 3072]----+
| ..o …. . |
| . o +G+. . * |
| . % ..B=. + Z . |
| C o -ooo+ O = .|
| = + . Z* * +.|
|o - . . . . o .|
| o . |
| |
| |
+----[SHA256]-----+
You will see the ssh key has been generated. In our example the default location /root/.ssh/ stores both the private ssh key and the public ssh key. To list your public key issue the below command. Remember to update the location if you choose a custom one above.
cat /root/.ssh/id_rsa.pub
Set Up SSH Keys On New Instances
If you are ordering a new NVMe VPS or reinstalling your current instance, you can supply your public key so it can be configured during setup. To supply your ssh key on a new order just enter your public ssh key on the order form.

Once installed, you will be able to connect and log in without a password. Remember to allow root logins. See the getting started guide for help completing this.
Add SSH Key To Existing Discovery Instance
If you already have a discovery instance, you can install your SSH key in a number of ways. If you are reinstalling your instance, add your public ssh key to the Discovery control panel.
- Under Instance Information click the pencil icon to the right.

- Add your SSH key at the bottom and click save

Now if you reinstall your instance the ssh key will be set up in your server automatically.
Add SSH Public Key To Exisitng Server
You can add your public key to existing servers by using the ssh-copy-id command. So, just specify the location of your public key and the server that you want to install the key on.
ssh-copy-id -i /root/.ssh/id_rsa.pub [email protected]
And now, you can log in to your server without a password by issuing the ssh root@server-ip command.
How was this article? – How To Set Up SSH Keys To Allow Access To Instances
You might also like
More from cPanel
How To Install Memcached PHP Cache In cPanel Servers
Memcached is an in-memory caching function that allows fast access and low-latency caching for PHP applications. Used by major companies …
How To Install A Cloudflare Origin SSL Certificate In cPanel
Free SSL Certificates from places like cPanel or Let's Encrypt are great. When Let's Encrypt first introduces free SSL Certificates …
Create a SWAP partition on CentOS, RHEL and AlmaLinux without a reboot
SWAP is a memory type that Linux NVMe VPS Servers use to process requests. Memory will be held in SWAP …