You will use the Terminal application on Mac OS X to generate an SSH key which will allow you to login to your server without manually entering a password, while giving you a higher level of security that comes from using key pairs.
Mac OS X Terminal
The terminal provides you with a text-based command line interface to the Unix shell component of Mac OS X. In order to get started with it, follow these steps:
- Open your Finder and select “Utilities” from the “Go” menu bar.
- Find the Terminal application in the list of utilities.
- Double-click the Terminal application to start it.
Once you’ve launched the terminal, you’ll see a screen with a prompt that contains your username as well as the name of your machine.
Generating an SSH key
An SSH key consists of a pair of files. One is the private key, which you should never give to anyone. The other is the public key. You will need a public key to log into cloud servers you provision. When you generate your keys, you will use
ssh-keygen to store the keys in a safe location so you can bypass the login prompt when connecting to your server.
To generate SSH keys in Mac OS X, follow these steps:
- Enter the following command in the Terminal window.
ssh-keygen -t rsaThis starts the key generation process. When you execute this command, the
ssh-keygenutility prompts you to indicate where to store the key.
- Press the ENTER key to accept the default location. The
ssh-keygenutility prompts you for a passphrase.
- Type in a passphrase. You can also hit the ENTER key to accept the default (no passphrase). However, this is not recommended.
Please note that 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/user/.ssh/id_rsa. Your public key has been saved in /Users/user/.ssh/id_rsa.pub. The key fingerprint is: ae:89:72:0b:85:da:5a:f4:7c:1f:c2:43:fd:c6:44:38 email@example.com 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. It's important to never share your private key with anyone, it is equivalent of your password!
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