How to configure the SSH Keys?
SSH keys provide a more secure alternative to logging into a private virtual server with SSH, compared to traditional login using a username and password. While a password can eventually be stolen with a brute force attack, SSH keys are almost impossible to crack using a brute force attack on its own.
Generating a key pair provides you with two long strings: a public and a private one. You can place the public key on any server, and then unlock it by connecting to it with a client that already has the private key. When these two keys match, the system will unlock without the need to enter a key. You can increase security, even more, protecting the private key with a passphrase or password.
- Step One:
Create the RSA Key Pair
The first step is to create your key pair on the client machine (there is a good chance that this machine is just your computer). Run the following command:
ssh-keygen -t RSA
- Step Two:
Store the Keys and Passphrase
Once you have entered the key generator command, you will be asked some additional questions:
Generating public/private RSA key pair.
Enter file in which to save the key (/home/david/.ssh/id_rsa):
You can do Enter, saving the file in the /home user directory (in our example, the example user is David).
Then you will be prompted for a passphrase, which is nothing more than an additional password that works in conjunction with SSH keys, providing additional security. It is not mandatory to specify a passphrase, if you don't want to, leave the field blank and press Enter.
Enter passphrase (empty for no passphrase)
It is up to you whether or not you want to use a passphrase. Entering an additional password or passphrase to SSH keys has its benefits: the security of a key, no matter how encrypted it is, still depends on whether or not it is visible to someone else. In the event that a private key protected through a passphrase falls into the hands of an unauthorized user, they will not be able to access the accounts associated with those SSH keys until they have that passphrase, giving the affected user a little more time.
Configuration of a more secure SSH access to a server:
Authentication by public key.
Public key authentication to connect to a remote server using the SSH protocol works with two keys: public and private. To understand how it works, the metaphor of padlock and key is often used. The public key works like a padlock and the private key like the key. The padlock will be placed on the remote server you want to access; when you try to access it, it will verify that the machine that is trying to connect has the key, the private key.
To configure SSH Keys with the public key you must:
- Generate the public key/private key pair.
- Copy the public key to the server.
- Disable access to the server with a password.
If these SSH Keys settings are a lot to process, Foxpass helps companies and agencies solve the security challenges of digital transformation with innovative access management solutions.
Comments
Post a Comment