I wanted to copy ssh keys to the server so that I could log in without requiring to enter the password. To do that typically I would ssh into the server and copy the public key of my laptop the authorized_keys on the remote server.
I came across a better way and I realized I have been doing it wrong for a very long time and there is a much simpler way to do it, using the ssh-copy-id command.
Just run the following command in the terminal
ssh-copy-id username@remote_server_ip
e.g
ssh-copy-id ubuntu@108.12.10.198
It will prompt you to enter the password, and then after that, it will copy the public key on your computer to the authorized_keys on the remote computer, and now you will be able to SSH without entering the password.
That’s it! Let me know if you have any questions or comments.
Leave a Reply