A quick way to create and upload an SSH key to the server

Mutt

Professional
Messages
1,057
Reputation
7
Reaction score
595
Points
113
6fd1e179-3a56-4d45-94d5-2b33e1479ba1.png

Let's create a key to access the SSH server to log into the server without a password. It is safer and faster.

Key creation
We create a key with sufficient durability like this:
Code:
ssh-keygen -t rsa -b 2048 -f ~ / .ssh / host_id_rsa

Replace in the key hostname with the name of the host for which the key is intended.

Uploading the key to the server
You can fill in the key with the command:
Code:
ssh-copy-id -i ~ / .ssh / host_id_rsa.pub user @ host

Also replace hostwith the name of the remote host in the file name and the connection address, userwith the name of the user under which the login is made. If a port other than the standard 22 is used, add the parameter, for example, -p 2222to the end of the command.
 
Top