The situation discussed here is that in which there are two different computers, called fromPC and toPC and there are two users, say, pablo@fromPC and echenique@toPC. (Of course, this trivially includes the case in which both users are called the same.)
Now, we want to ssh from pablo@fromPC to echenique@toPC without having to type echenique‘s password each time.
So, first, we log as pablo in fromPC and issue the command
ssh-keygen -t rsa
This creates a file called
id_rsa.pub in the
.ssh/ subdirectory of pablo‘s home. Inside this file, there is a line full of letters and numbers. In my case, it reads
ssh-rsa AAAAB3NzaC1yc2EAZAABIwAAAIEAtOryp8y1S2S Q6OAiHTRcq7SClWt4fYuJMrl+9+lTmZghxGnBn2GHZVR9ct NcXpx7eSRLf4sSS2ZBGZd3AjWSp+WQXpcmgM4tlm7uvhsL2 LYaE90l/r9tUuBvu6JBZp8gi1HazkwZCOussYfx395JHDE8 MwCjaajjaMxTX2pZ2z0= pablo@fromPC
(kind of lying )
Next, we log as echenique in toPC and look for a file called
authorized_keys in the
.ssh/ subdirectory of echenique‘s home. If it does not exist, we create it and paste the above weird line into it, if it already exists, we add the line at the end. We save the file et voilà.