SSH stands for Secure Socket Shell and is a network protocol that provides administrators with a secure way to access a remote computer. SSH keys can be created automatically on your Macintosh.
cPanel is an online Linux-based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a website. It is offered by most web-hosts as a way to manage the back-end of a website for Linux servers.
In using SSH you will create private and public keys on your Macintosh
1. Make Hidden Files Visible on a Mac
On a Macintosh, the keys will be generated in a hidden folder (SSH), so first we will need to make hidden files visible.
Open up the Terminal App on your Mac and type this command:
defaults write com.apple.finder AppleShowAllFiles YES
Next, you will need to restart Finder so the changes take effect:
2. Create the Keys on your Mac
Inside Terminal, we will now create the keys on our Macintosh:
ssh-keygen -t rsa -C "email@example.com"
You will then be prompted to create a pass phrase.
Pass Phrases are not passwords. They can have spaces. Make sure you save this somewhere. You will have to upload it to your cPanel account.
The keys are located at the user .ssh folder on your Mac.
In Finder, navigate to /Users/YourUserName/.ssh/ if you want to see it.
id_rsa is the private key, and id_rsa.pub is the public key.
It’s also best practice to restrict read and write access to your username so that other users can’t read your private key. Many servers by default will deny the key if they do not see the chmod 400 restriction.
chmod 400 /Users/YourUserName/.ssh/id_rsa
Note: You can now add your SSH folder to your Favorites in Finder. If you are creating multiple SSH keys for multiple websites the active keys will be the ones in the SSH folder. However, you can create sub-folders to place the inactive keys in.
3. Add the Private Key to your User Profile
In Terminal, navigate to the folder this way:
Then add your username to the keys. (YourUserName is not the folder directory. Use your actual username ‘Bob’, ‘BobSmith’, etc.)
4. Upload the Public Key to cPanel
Finally, import the keys into your cPanel Web Disk account on your web host.
Login to your cPanel account, and then navigate to Security > SSH
Here you will import the keys you created on your Macintosh into your cPanel account.
You can use the TextEdit app on your Macintosh to open up these files to copy their contents or
Note: TextEdit does not open .pub files, so you will need to duplicate it and convert the duplicate to .txt to see it in TextEdit.
Alternatively, use the
Once installed, you will have to authorize the keys in cPanel.
5. Logging In
Port 22 is the standard port used to access SSH. Here’s why: https://www.ssh.com/ssh/port#sec-How-SSH-port-became-22
Navigate to your SSH folder in Terminal and make sure you have both keys in that folder.
In Terminal, request access by making a request to port 22 using your cPanel user account name.
ssh -p 22 firstname.lastname@example.org
Note: If you are using a service like Sucuri or another reverse proxy, make the request to the
ssh -p 22 email@example.com
If you used a passphrase you will be prompted to enter it. Enter it with the spaces if you used a phrase with spaces.