Key based authentication also known as public key authentication allows you to log into a server without having to remember your password or worst needing to write down the password. Most important Public key authentication provides cryptograph strength over the most complex password. It is now more common for users to log into a server using a public key than typing a password.
VPS Cloud+ puts the importance of security before any other operations as such we have strived to make SSH key management as easy as possible to our users while maintaining high-security standards.
Are you new to SSH Keys? Here are a few key concepts
SSH Key pair includes two keys:
A public key: This is the key copy that is shared with trusted parties. With a valid public key, user can encrypt data that can only be decrypted by the corresponding private key. More to come on private key. Worth noting a copy of a public key can be relieved to a third party without compromising the security integrity.
A private key: This is the counterpart of the pubic key. This part of the key pair is kept secret by the SSH user and MUST NOT be distributed. The SSH user with a private key that corresponds to the host public key is allowed SSH access to the host server. Both, private and public keys are generated as a pair on the SSH server at the same time. It is important the SSH user identifies the private key and stores the key in a secured location where only the user with admin privileges can access the private key. For Linux, Windows, and macOS the default location for the public key is in
/home/user/.ssh or simply
~/.ssh. You can specify a location of your choice when generating the SSH Key pair.
Generating SSH Key with OpenSSH
Before we dive into how to generate SSH key pair using OpenSSH let's see what is OpenSSH; by definition, OpenBSD Secure Shell or OpenSSH is a suite of secure networking utilities demons based on the Secure Shell (SSH) protocol, which provides a secure channel over an unsecured network in a client-server architecture and is available in most macOS and Linux distributions. You will need to manually install OpenSSH on Windows 10. OpenSSH generates SSH Key pair using ssh-keygen. The following is an example for generating SSH Key pair using OpenSSH.
First, check if OpenSSH is installed on your machine, you can do this by typing
ssh –v on your terminal. Command not found indicates OpenSSH is not installed on your machine. You will need to install OpenSSH to continue.
Once you have verified OpenSSH is installed on your machine it takes less than a minute to generate SSH key pair. Follow the below simple steps to generate SSH key pair.
On your terminal run commands
Expected terminal output:
Generating public/private rsa key pair. Enter file in which to save the key (/Users/vpscloud/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in id_rsa. Your public key has been saved in id_rsa.pub.
The key fingerprint is: SHA256:JjRWtoxHBR5E+EKtQNIgjT8GSVI9A4RPnGRWPsAVOOg test@VpscloudServer The key's randomart image is: +---[RSA 3072]----+ |+&@@=. =Oo. | |B+O+* oB.o | |.= .o==o= | | E= +oo. | | . . ..S | | o | | | | | | | +----[SHA256]-----+