Radek Sprta (Posts about rapsbian)https://radeksprta.eu/categories/rapsbian.atom2024-01-07T02:28:55ZRadek SprtaNikolaSet Up Password-less SSH Login and Secure Your SSHhttps://radeksprta.eu/posts/set-up-password-less-ssh-login-and-secure-your-ssh/2017-06-26T16:12:57+02:002017-06-26T16:12:57+02:00Radek Sprta<div><p>You have Raspberry Pi <a href="https://radeksprta.eu/setting-up-headless-raspberry-pi-server/">set up and running</a>,
but typing password every time you try to
login using ssh is quite the pain. Well, using key-based authentication is not
only more convenient, but also more secure. Let's see how to set it up.</p>
<h3>Set up password-less SSH</h3>
<p>First of all, you need to generate the public / private key for your computer
using this command:</p>
<div class="code"><pre class="code literal-block">$ ssh-keygen -t rsa -b 4096
</pre></div>
<p>You will
be asked for a pass-phrase. Using one is highly recommended. You should use
one that is long, preferably a whole sentence, and different from your
password. Avoid using famous quotes, as your pass-phrase could easily get
cracked by a dictionary attack. Next, upload the key to your Pi:</p>
<div class="code"><pre class="code literal-block">$<span class="w"> </span>ssh-copy-id<span class="w"> </span>-i<span class="w"> </span>~/.ssh/id_rsa.pub<span class="w"> </span>pi@raspberrypi.local
</pre></div>
<p>If it failed
to connect, just use the Pi's ip adress in place of <code>rapsberrypi.local</code>. You
should now be able to connect to your pi using the key.</p>
<p><a href="https://radeksprta.eu/posts/set-up-password-less-ssh-login-and-secure-your-ssh/">Read moreā¦</a> (1 min remaining to read)</p></div>