Home/Manual/Article

How to generate SSH keys for Linux Virtual Machines?

Shreyash Pawar
November 27, 2025
8 min read
VPS ManagementCloud ComputingDevOps
VPS file Manager and Terminal

This tutorial shows how to generate SSH keys for Linux Virtual Machines.

SSH stands for Secure Shell. This is the protocol that connects us to the remote machines to execute our commands. But you must authenticate your connection so that only the authorised user can access the virtual machine. Otherwise, any malicious user will use the machine for their malicious intentions.
There are two ways to authenticate yourself for an SSH connection, i.e., through passwords or SSH keys. SSH keys are considered the most secure type of authentication, so that is what we use in IIusion: A file Manager and terminal for VPS to connect with the machines.

Let us look at how we can generate these keys and use them in Ilusion: A file Manager and terminal to connect with the VPS.

Create and set up SSH Keys on Linux VM

As a starting point, we will need to create keys using the ssh-keygen tool for SSH. Look at the following ssh-keygen command, which generates the SSH key in a Linux Virtual Machine:

ssh-keygen
ssh-keygen executed

Figure 1: ssh-keygen executed

The above command creates the two keys for your SSH authentication, i.e., Private and Public keys. The public key will be inside the file that has a .pub extension. It also asks for file name and paraphrases, but it is fine to keep them blank. The Public key has to be sent to the server using the following command:

ssh-copy-id -i ~/public_key_location.pub vm_user@vm_host

Of course, this command will ask for a password or SSH keys for authentication. If you had connected to that machine earlier, then the same SSH keys will be reused. After adding the key using the above command, we are all set to log in to the server using the SSH protocol using the following command:

ssh -i ~/private_key vm_user@vm_host
ssh-copy-id & ssh executed

Figure 1: ssh-copy-id & ssh executed

Conclusion

SSH keys are the best way to authenticate the user for the VPS. We have created the SSH keys using the ssh-keygen tool and connected with the VPS.

There are two keys used: private and public keys. The public will be at the host, and the private will be used to authenticate a particular client.

Ready to Get Started?

Experience the power of modern VPS management with our intuitive platform.

Start
SP

Shreyash Pawar