Passwordless SSH One-Liner

tonymet

Tony Metzidis

Posted on June 25, 2020

Passwordless SSH One-Liner

When you need to get your key onto another machine, and you don't want the silly login-logout-copy-paste nonsense. Do this:

$ cat ~/.ssh/id_rsa.pub | ssh pi@pihole3bplus.local bash -c "mkdir -p .ssh && cat >> .ssh/authorized_keys"

Don't have a key? Here's how to make one

ssh-keygen
# smash the enter button
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/tonymet/tmp/kaka.
Your public key has been saved in /Users/tonymet/tmp/kaka.pub.
The key fingerprint is:
SHA256:WXXXXX
The key's randomart image is:
+---[RSA 3072]----+
|o.+++=+*Bo=.     |
| . xxxxxxxxx . . |
|   xxxxxxxxx+ + .|
|  xxxxxxxxxx = . |
|     = .S . =    |
|      B    o .   |
|     + .         |
|      .          |
|                 |
+----[SHA256]-----+
💖 💪 🙅 🚩
tonymet
Tony Metzidis

Posted on June 25, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related