From 09290eae7c5b55cd1189850caf1756c1479615da Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 25 Jun 2020 05:05:42 +0000 Subject: [PATCH] update ssh-pubkey cheatsheet --- ssh-pubkey/README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/ssh-pubkey/README.md b/ssh-pubkey/README.md index 8514a9d..fe0cb78 100644 --- a/ssh-pubkey/README.md +++ b/ssh-pubkey/README.md @@ -7,3 +7,33 @@ linux: true description: | `ssh-pubkey` will make sure you have an SSH key, and then print it to the screen and place it in `~/Downloads` --- + +Get your public key, the easy way: + +```bash +ssh-pubkey +``` + +```txt +~/Downloads/id_rsa.johndoe.pub: + +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTOhRnzDJNBNBXVCgkxkEaDM4IAp81MtE8fuqeQuFvq5gYLWoZND39N++bUvjMRCveWzZlQNxcLjXHlZA3mGj1b9aMImrvyoq8FJepe+RLEuptJe3md4EtTXo8VJuMXV0lJCcd9ct+eqJ0jH0ww4FDJXWMaFbiVwJBO0IaYevlwcf0QwH12FCARZUSwXfsIeCZNGxOPamIUCXumpQiAjTLGHFIDyWwLDCNPi8GyB3VmqsTNEvO/H8yY4VI7l9hpztE5W6LmGUfTMZrnsELryP5oRlo8W5oVFFS85Lb8bVfn43deGdlLGkwmcJuXzZfostSTHI5Mj7MWezPZyoSqFLl johndoe@MacBook-Air +``` + +Create an SSH keypair if you don't have one: + +```bash +[ -f "$HOME/.ssh/id_rsa" ] || ssh-keygen -b 2048 -t rsa -f "$HOME/.ssh/id_rsa" -q -N "" +``` + +Copy your public key to `~/Downloads`: + +```bash +rsync -av "$HOME/.ssh/id_rsa.pub" "$HOME/Downloads/id_rsa.$(whoami).pub" +``` + +Print your public key to the Terminal: + +```bash +cat "$HOME/Downloads/id_rsa.pub" +``` -- 2.25.1