fe0cb789bc5e2f0129460e94290edbe7182c5dbe
[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 Create an SSH keypair if you don't have one:
24
25 ```bash
26 [ -f "$HOME/.ssh/id_rsa" ] || ssh-keygen -b 2048 -t rsa -f "$HOME/.ssh/id_rsa" -q -N ""
27 ```
28
29 Copy your public key to `~/Downloads`:
30
31 ```bash
32 rsync -av "$HOME/.ssh/id_rsa.pub" "$HOME/Downloads/id_rsa.$(whoami).pub"
33 ```
34
35 Print your public key to the Terminal:
36
37 ```bash
38 cat "$HOME/Downloads/id_rsa.pub"
39 ```