SSH Keys

SSH keys are a pair of private and public keys. Private key - secret information stored by the user. The public key must be stored on a server that will be accessed via SSH.

Generating SSH Keys
On Linux systems, keys are generated as follows:

ssh-keygen [options]
The main options are -t to specify the encryption algorithm and -b to specify the key length:

ssh-keygen -t rsa -b 4096
ssh-keygen -t dsa
ssh-keygen -t ecdsa -b 521
ssh-keygen -t ed25519
When generating keys, specify the path to the file where the private key will be written. The public key will be written to a file named <path to file> .pub.

Copying the public key
The user's public key must be copied to the server, which will be accessed via the SSH protocol, to the ~ / .ssh / authorized_keys file:

ssh-copy-id -i ~ / .ssh / id_rsa.pub user @ host

user - the user account of the remote server.

host - the IP address of the remote server.

~ - the directory of the home folder of the remote server user.

When connecting, you need to enter the password of the remote server user.

  • 237 Users Found This Useful
Was this answer helpful?

Related Articles

Operations on virtual machines

Operations are divided into basic and additional. All operations on a virtual machine launched...

VPS connection via SSH

To connect, we need data, if you don't know where to get it, don't worry, everything is here.We...

How to enter the VPS control panel, find out your IP and password for SSH and VNC

By clicking on the link https://vm.darkhost.pro/, we will be taken to the login page of the VPS...

Backups

A backup is an image of a virtual machine (VM) disk that is used to restore it. Unlike custom...

Recovery mode

Virtual machine (VM) recovery mode - starts a VM with a LiveCD image of the SystemRescueCD...