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

Recovery mode

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

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 create a script

Scripts allow you to automatically configure virtual machines: install software, change...

What is VNC and how to use it. How to enter a virtual machine on Android

VNS is a system of remote access to a computer desktop. Allows you to transfer keystrokes on the...

Operations on virtual machines

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