The Secure SHell (SSH) command line is available through a Mac using the Terminal application. A private and public key pair is required before you can connect to the server. These instructions are for use with a shared server. Learn more about SSH Hosting.
Generate Key for Shell Access
- Login to the cPanel and then go to the SSH/Shell Access icon. Click on it to access the section where you can generate the private key.
- Click on the button labeled Manage SSH Keys
- Click on the button labeled Generate a new key
- Type in a password (do NOT use the password generator), then confirm it. Make sure to write down the password you used or save a copy in a secure location. Leave the key type at RSA and key size at 2048. You can choose to make it 4096, if you wish.
- If you are creating a key for the first time, click on the Generate Key button.
- You should then see a confirmation that the key was generated. Click on the Go Back button to return to the Manage SSH Keys page.
- You should see the Public key and the Private key generated with the name “id_rsa”. Click on View/Download for the PRIVATE key. This is the key that you will need to load onto your Mac.
- Download the file to your Mac client. To make it simple for this tutorial, copy the file to your desktop.
- Check to see if the Public key has an authorization status of NOT AUTHORIZED. Newly generated keys are not initially authorized for use. Click on the Manage link. You will see a blue Authorize button. Click on this button to authorize the key. NOTE: If you don’t authorize this key, it doesn’t matter what you do on the Mac side, you won’t be able to login.
The next part of the process requires that you login to your Mac as an administrator. We will be using the default Terminal application to login to SSH using the key that we generated above.
Use Apple Terminal Program to Connect to SSH
- Login to your Terminal program. If you don’t know how to do this, go the magnifying glass on the Apple desktop. This is usually at the top right and is called Spotlight Search in the current Mac OS. Type in “terminal” then hit enter. You should see Terminal appear as an application. Select it and it will launch. Note that if you are not logged into your Mac as the administrator you will not be able to make these changes.
- Go to your desktop where you copied the ID_RSA file. The terminal command is: cd desktop
- Make sure that the ID_RSA file is already on your desktop. Then type the following into your terminal:cp -frp id_rsa ~/.sshThis will copy the key into the .ssh folder.
- When this is complete, you will be able to use the SSH command to login to the server. The cPanel user name will need to be used along with the server name. The command will look like this:ssh -p 2222 [email protected]Here’s an example: ssh -p 2222 [email protected])
- If this is the first time you have connected the server, you may see a message stating that it can’t identify the server. Just click on “YES” to proceed (just make you’re connecting to the right server). The password should automatically work and you should see the terminal connect.
This completes the tutorial for creating a new SSH key to connect your Mac terminal program to the InMotion Hosting shared server SSH. For best security practices, make sure to keep your key private and don’t share the password unless necessary.
Toggle panel: Easy SEO