How do I create a ssh key to connect to server

September 21, 2013 3.3k views
I know that I could create a ssh key file to connect to server via ssh without having to use the root password or some other user password can you please post a link to steps or tell me how. thanks
5 Answers
by Etel Sverdlov
SSH keys provide a more secure way of logging into a virtual private server with SSH than using a password alone. With SSH keys, users can log into a server without a password. This tutorial explains how to generate, use, and upload an SSH Key Pair.
Personally, I'd recommend this tutorial: https://library.linode.com/securing-your-server - it's very detailed.
Hi,
I started the tutorial (digital ocean) and I was able to get to this point
cat myfiile_rsa.pub | ssh myusername@1.1.1.1 "cat >> ~/.ssh/authorized_keys"
myusername@1.1.1.1's password:
bash: /home/myusername/.ssh/authorized_keys: No such file or directory

Do I have to create the directories? install a package ?

Note I replaced my ip and username with fake ones (1.1.1.1 and my username )
I created the directory .ssh and now it works...
Have another answer? Share your knowledge.