a5197f190c4884e315484f632afba8c8fd0a6ea2
[webi-installers/.git] / ssh-pubkey / README.md
1 ---
2 title: SSH Pub Key
3 homepage: https://webinstall.dev/ssh-pubkey
4 tagline: |
5   Get your SSH public key.
6 linux: true
7 description: |
8   `ssh-pubkey` will make sure you have an SSH key, and then print it to the screen and place it in `~/Downloads`
9 ---
10
11 Get your public key, the easy way:
12
13 ```bash
14 ssh-pubkey
15 ```
16
17 ```txt
18 ~/Downloads/id_rsa.johndoe.pub:
19
20 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTOhRnzDJNBNBXVCgkxkEaDM4IAp81MtE8fuqeQuFvq5gYLWoZND39N++bUvjMRCveWzZlQNxcLjXHlZA3mGj1b9aMImrvyoq8FJepe+RLEuptJe3md4EtTXo8VJuMXV0lJCcd9ct+eqJ0jH0ww4FDJXWMaFbiVwJBO0IaYevlwcf0QwH12FCARZUSwXfsIeCZNGxOPamIUCXumpQiAjTLGHFIDyWwLDCNPi8GyB3VmqsTNEvO/H8yY4VI7l9hpztE5W6LmGUfTMZrnsELryP5oRlo8W5oVFFS85Lb8bVfn43deGdlLGkwmcJuXzZfostSTHI5Mj7MWezPZyoSqFLl johndoe@MacBook-Air
21 ```
22
23 The standard location for your SSH Public Key:
24
25 ```bash
26 ~/.ssh/id_rsa.pub
27 ```
28
29 How to create an SSH Keypair if it doesn't already exist:
30
31 ```bash
32 if [ -f "$HOME/.ssh/id_rsa" ];then
33     ssh-keygen -b 2048 -t rsa -f "$HOME/.ssh/id_rsa" -q -N ""
34 fi
35 ```
36
37 How to copy your SSH Public Key to from its hidden folder to your `Downloads`
38 folder:
39
40 ```bash
41 rsync -av "$HOME/.ssh/id_rsa.pub" \
42     "$HOME/Downloads/id_rsa.$(whoami).pub"
43 ```
44
45 How to print your public key to the Terminal:
46
47 ```bash
48 cat "$HOME/Downloads/id_rsa.pub"
49 ```