Categories
OS X

Create SSH Keys in OS X

SSH stands for “secure shell” and is a secure way to log in from a Mac to your web host’s server. You can create keys in your terminal and upload them to a web host control like panel, like cPanel.

To begin the process you will need to generate keys. If you are using cPanel you will need to use the account’s cPanel username and web address for the keys to work correctly.

ssh-keygen -t rsa -C "cpanel-username@111.22.33.444"

You will then be prompted to create a passphrase. These are unlike passwords in that they can have spaces. Feel free to use lyrics, mottos, poems, or quotes.

The key generated is located in the user’s .ssh folder your Mac. You can navigate to that folder in Terminal with this command:

ls/Users/Doug/.ssh/

Then, add yourself to the keys:

ssh-add/Users/Doug/.ssh/id_rsa

Finally, you will import the RSA key to cPanel. This is found on your cPanel dashboard under Security > SSH Access > Manage Keys > Import Key.

From here you will give your key an ID (id_doug), paste the private key (id_rsa), the public key (id_rsa.pub), and enter your passphrase.

Next, in cPanel you will need to authorize the keys in Security > SSH Access > Manage Keys.

Now you can log in from a terminal using your SSH keys. Typically we access port 22. If you are using cPanel you will have to use your account’s username to log in. The IP address of your server will serve as the web address:

ssh -p 22 cpanel-username@111.22.33.444

You will then be prompted to enter your passphrase. You will not see visual confirmation that you are typing your passphrase in, but it is.

Once you confirm that SSH access is working feel free to delete unnecessary FTP accounts. SSH is far more secure, and the first step towards using git version control services like BitBucket, GitHub, and SourceTree.

Leave a Reply