How to add public ssh Key to Remote Server

Adding a public ssh key to a remote server will allow you to access that server without being prompted for the password everytime time.

Here are the steps you should follow.

1- Generate the keys

ssh-keygen -t rsa

2- Push the key to the remote server

cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'