This is mostly needed by beginner network admin which login into several server from their laptop / PC and inserting password each login. We can avoid this inserting password by using public keys. Now, go to client and generate public key by :
1 | ssh-keygen -t rsa |
Then you need to copy your public key to server by :
1 | scp ~/.ssh/id_rsa.pub <username>@<you-server-host-or-ip>:<your-folder-path>/id_rsa_client.pub |
Then, login into server. In this cases, I use use “ubuntu” for username and “/home/ubuntu” as default home path. Also, I assume “id_rsa_laptop.pub” located in “/home/ubuntu”.
1 2 3 | cd ~/ mkdir .ssh cat id_rsa_laptop.pub > .ssh/authorized_keys2 |
Done! Just it! Now you can login into your server without inserting password 🙂