🔐

How to install your SSH key on a remote server

1*. Nice way*

You can install an SSH key by executing

ssh-copy-id [email protected]

Now you can log in to the remote server with your password and ssh-copy-id will do the rest.

2. Manual way

Append your public ssh key to the authorized_key file on the server.

As a one-liner:

cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat>> ~/.ssh/authorized_keys'

Conclusion

Both commands pretty much do the same. The first way is way easier though.

The next time you can connect to the server using your SSH key.

ssh [email protected]