SSH Public Key Authentication

Public SSH key authentication is an SSH authentication method that allows users to use cryptographically generated keys to log into remote servers.

SSH keys are more secure than raw passwords and provide a much more efficient way of logging into SSH. SSH keys are automated, and once authorized, do not require a password at each login.

To use an SSH key, we will begin by generating a key.

We can generate private & public key :


The ssh-copy-id command is a simple tool that allows you to install an SSH key on a remote server’s authorized keys. This command facilitates SSH key login, which removes the need for a password for each login, thus ensuring a password-less, automatic login process. The ssh-copy-id command is part of OpenSSH, a tool for performing remote system administrations using encrypted SSH connections.

Now we copy our public ssh key to remote server :

ssh-copy-id -p 22 -i ~/.ssh/ username@host

Test our SSH Public Key Authentication :

ssh username@host



Add ping

Trackback URL :

Page top