Using SSH Keys

The SSH daemon validates SSH client access by Linux system verification via /etc/passwd, or by public/private key cryptography approach. By using the public/private cryptography approach, we can do a SSH without password.

Step 1: Generate the public-private keys using the ssh-keygen command.

$ ssh-keygen -t ed25519
  • -t is the type of key
  • ed25519 is considered more secure and better performance than rsa.

Step 2: The resulting files are id_ed25519 (private key) and id_ed25519.pub (public key). Copy the public keys to the remote computer with the following commands

$ ssh-copy-id -i ~/.ssh/id_ed25519.pub user@remote-host

You will be asked for your password and the public keys will be added to your ~/.ssh/authorized_keys on the remote system. If you SSH in, you should be able to login in without password.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s