<p>How do I setup Public-Key Authentication for SSH?</p>

[{'answer_id': 7481, 'author': 'roo', 'author_id': 716, 'author_profile': 'https://Stackoverflow.com/users/716', 'pm_score': 3, 'selected': False, 'text': '<p>For windows <a href="http://the.earth.li/~sgtatham/putty/0.53b/htmldoc/Chapter8.html" rel="noreferrer">this</a> is a good introduction and guide</p>\n\n<p>Here are some good ssh-agents for systems other than linux.</p>\n\n<ul>\n<li>Windows - <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" rel="noreferrer">pageant</a></li>\n<li>OS X - <a href="http://www.askbjoernhansen.com/2005/01/07/sshkeychain_ssh.html" rel="noreferrer">SSHKeychain</a></li>\n</ul>\n'}, {'answer_id': 9095, 'author': 'dbr', 'author_id': 745, 'author_profile': 'https://Stackoverflow.com/users/745', 'pm_score': 8, 'selected': True, 'text': "<p>If you have SSH installed, you should be able to run..</p>\n\n<pre><code>ssh-keygen\n</code></pre>\n\n<p>Then go through the steps, you'll have two files, <code>id_rsa</code> and <code>id_rsa.pub</code> (the first is your private key, the second is your public key - the one you copy to remote machines)</p>\n\n<p>Then, connect to the remote machine you want to login to, to the file <code>~/.ssh/authorized_keys</code> add the contents of your that <code>id_rsa.pub</code> file.</p>\n\n<p>Oh, and <code>chmod 600</code> all the <code>id_rsa*</code> files (both locally and remote), so no other users can read them:</p>\n\n<pre><code>chmod 600 ~/.ssh/id_rsa*\n</code></pre>\n\n<p>Similarly, ensure the remote <code>~/.ssh/authorized_keys</code> file is <code>chmod 600</code> also:</p>\n\n<pre><code>chmod 600 ~/.ssh/authorized_keys\n</code></pre>\n\n<p>Then, when you do <code>ssh remote.machine</code>, it should ask you for the key's password, not the remote machine.</p>\n\n<hr>\n\n<p>To make it nicer to use, you can use <code>ssh-agent</code> to hold the decrypted keys in memory - this means you don't have to type your keypair's password every single time. To launch the agent, you run (including the back-tick quotes, which eval the output of the <code>ssh-agent</code> command)</p>\n\n<pre><code>`ssh-agent`\n</code></pre>\n\n<p>On some distros, ssh-agent is started automatically. If you run <code>echo $SSH_AUTH_SOCK</code> and it shows a path (probably in /tmp/) it's already setup, so you can skip the previous command.</p>\n\n<p>Then to add your key, you do</p>\n\n<pre><code>ssh-add ~/.ssh/id_rsa\n</code></pre>\n\n<p>and enter your passphrase. It's stored until you remove it (using the <code>ssh-add -D</code> command, which removes all keys from the agent)</p>\n"}]
['https://Stackoverflow.com/questions/7260', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/889/']