These steps are verified and tested several times and works flawlessly.
1. Install openssh server
sudo apt-get <span class="hljs-keyword">install</span> openssh-<span class="hljs-keyword">server</span>
2. Remove previous .ssh directory (from home directory)
rm -r ~<span class="hljs-regexp">/.ssh/</span>
3. Now Execute the below command. Leave all the field empty when asked.
<span class="hljs-attribute">ssh-keygen -t rsa</span>
4. Execute the following commands after that
cat ~<span class="hljs-regexp">/.ssh/id</span>_rsa.pub >> ~<span class="hljs-regexp">/.ssh/authorized</span>_keys
sudo chmod go-w ~<span class="hljs-regexp">/
chmod 700 ~/</span>.ssh
chmod <span class="hljs-number">600</span> ~<span class="hljs-regexp">/.ssh/authorized</span>_keys
exec ssh-agent bash
ssh-add
That’s it.
You can test on your machine.
ssh-<span class="hljs-keyword">copy</span><span class="bash">-id localhost
</span>ssh localhost
When you ssh localhost, it will not ask you password again.
Leave a Reply