c5829adf9d0ce0f8e99488b73e20d886a8bb5c66
[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 description: |
7   > Your SSH Public Key is used for secure login from your laptop to servers and
8   > other network devices - such as Raspberry Pis, game consoles, and home cloud
9   > systems. The file public key _always_ ends in `.pub`.
10
11   `ssh-pubkey` will:
12
13     1. Create a new ssh keypair if you don’t already have one
14     2. Copy your new or existing SSH Public Key to your `Downloads` folder
15     3. Print the location of the copied key, and its contents to the screen
16 ---
17
18 The easiest way to get your SSH Public Key:
19
20 ```bash
21 curl https://webinstall.dev/ssh-pubkey | bash
22 ```
23
24 ```txt
25 ~/Downloads/id_rsa.johndoe.pub:
26
27 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTOhRnzDJNBNBXVCgkxkEaDM4IAp81MtE8fuqeQuFvq5gYLWoZND39N++bUvjMRCveWzZlQNxcLjXHlZA3mGj1b9aMImrvyoq8FJepe+RLEuptJe3md4EtTXo8VJuMXV0lJCcd9ct+eqJ0jH0ww4FDJXWMaFbiVwJBO0IaYevlwcf0QwH12FCARZUSwXfsIeCZNGxOPamIUCXumpQiAjTLGHFIDyWwLDCNPi8GyB3VmqsTNEvO/H8yY4VI7l9hpztE5W6LmGUfTMZrnsELryP5oRlo8W5oVFFS85Lb8bVfn43deGdlLGkwmcJuXzZfostSTHI5Mj7MWezPZyoSqFLl johndoe@MacBook-Air
28 ```
29
30 The standard location for your SSH Public Key:
31
32 ```bash
33 ~/.ssh/id_rsa.pub
34 ```
35
36 How to create an SSH Keypair if it doesn't already exist:
37
38 ```bash
39 if [ -f "$HOME/.ssh/id_rsa" ];then
40     ssh-keygen -b 2048 -t rsa -f "$HOME/.ssh/id_rsa" -q -N ""
41 fi
42 ```
43
44 How to copy your SSH Public Key to from its hidden folder to your `Downloads`
45 folder:
46
47 ```bash
48 rsync -av "$HOME/.ssh/id_rsa.pub" \
49     "$HOME/Downloads/id_rsa.$(whoami).pub"
50 ```
51
52 How to print your public key to the Terminal:
53
54 ```bash
55 cat "$HOME/Downloads/id_rsa.pub"
56 ```