How to generate a SSH key on macOS or Mac OS X


You're going to need to use your Terminal app on Mac to do this. What you are doing is creating a pair of key files - a private key, which you should never give anyone and should keep private, and a public key which can be given out. This public key can be used to authenticate over SSH on your Linux server.

  1. Launch Terminal (or another terminal app such as iTerm2 if you have it)
  2. Enter the following command in the Terminal window:
    ssh-keygen -t rsa
  3. Press Enter to accept the default location.
  4. Enter a passphrase to unlock your private key. You can press enter to skip this, but it is not recommended as anyone can use your private key without a password!
  5. Enter the passphrase again to confirm and press enter.
After you confirm the passphrase, the system generates the keypair.

Your identification has been saved in /Users/user/.ssh/id_rsa.
Your public key has been saved in /Users/user/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:yT0K11Tks8tmk+P/n1VKg2MDNhBpihz64decUiyR8fs user@user-mbp.local
The key's randomart image is:
+---[RSA 3072]----+
|      .ooo .o    |
|    . o.o. o     |
|   o o =. = o    |
|  . + o.oB o +   |
|   o ..=S.+ * o .|
|    o oo+o + * o.|
|     . .. E O . .|
|           + o  o|
|            ...o+|
+----[SHA256]-----+
Your private key is saved to the id_rsa file in the .ssh directory and is used to verify the public key you use. Never share your private key! Treat it as you would a password. Your public key is saved to the id_rsa.pub file and is the key you'll upload to your server or provide NodeSpace support. You can copy this key to your clipboard by running:
pbcopy < ~/.ssh/id_rsa.pub

Comments

  Add Comment

Confirm Submission

Please enter the text from the image in the box provided, this helps us to prevent spam.



Powered by WHMCompleteSolution