Generate SSH key
To generate SSH keys in macOS, follow these steps:
1. Enter the following command in the Terminal window.
$ ssh-keygen -t rsa
This starts the key generation process. When you execute this command, the ssh-keygen
utility prompts you to indicate where to store the key.
2. Press the ENTER key to accept the default location. The ssh-keygen
utility prompts you for a passphrase.
3. Type in a passphrase. You can also hit the ENTER key to accept the default (no passphrase). However, this is not recommended.
You will need to enter the passphrase a second time to continue.
After you confirm the passphrase, the system generates the key pair.
Your identification has been saved in /Users/myname/.ssh/id_rsa.
Your public key has been saved in /Users/myname/.ssh/id_rsa.pub.
The key fingerprint is:
ae:89:72:0b:85:da:5a:f4:7c:1f:c2:43:fd:c6:44:38 myname@mymac.local
The key's randomart image is:
+--[ RSA 2048]----+
| |
| . |
| E . |
| . . o |
| o . . S . |
| + + o . + |
|. + o = o + |
| o...o * o |
|. oo.o . |
+-----------------+
Your private key is saved to the id_rsa
file in the .ssh
directory and is used to verify the public key you use belongs to the same cloud server.
Private key is like your password so Never share your private key with anyone!
Your public key is saved to the id_rsa.pub
file and it is the key you’ll upload to our cloud service. You can save this key to the clipboard by running this:
pbcopy < ~/.ssh/id_rsa.pub
Let me know your thoughts