How-To Generate your SSH key

Serhii Horoshko
1 min readJul 20, 2020

--

Open the Terminal and execute the command below using your corporate e-mail:ssh-keygen -t rsa -b 4096 -C "your_email@company.com"

At the interpreter’s suggestion to enter the path to the file, just press Enter:
Enter file in which to save the key

You can optionally set a password or just press Enter 2 times:
Enter passphrase (empty for no passphrase)
Enter same passphrase again:

When done, the key generation program will notify you of its location:
Your identification has been saved in /Users/username/.ssh/id_rsa
Your public key has been saved in id_/Users/username/.ssh/id_rsa.pub

Now you need to display the contents of the public key. The file has the extension pub. You can do this using the cat command:
cat /Users/username/.ssh/id_rsa.pub

The contents of the file will be output to the terminal:

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU
GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XAt3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/EnmZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbxNrRFi9wrf+M7Q== schacon@mylaptop.local

Reference

  1. Git on the Server — Generating Your SSH Public Key
  2. Generating a new SSH key and adding it to the ssh-agent
  3. How To Set Up SSH Keys

--

--

Responses (1)