Guides

Setting up SSH in Ubuntu 18.04

The following troubleshooting guide will help you SSH into your remote web server in Ubuntu Desktop 18.04. This was done on a VirtualBox VM for an InMotionHosting.com shared hosting account.

In your Ubuntu machine, open a Terminal and navigate to your Home directory if not already there.

cd ~

While in the Home directory, create a new folder called .ssh (with the period in front of the letters).

mkdir .ssh

Now in your cPanel WHM panel, go to your SSH Access or SSH Key Manager.

Create a new key by clicking the Generate a New Key button. This will bring you to a page with a Public Key generating wizard.

Choose a new name for the public key or leave as default id_rsa. Create a strong password. Select dropdown options Key Type: RSA and Key Size: 2048. Then generate the key.

Once you are back at the main SSH Access page, you will need to authorize your Public Key. Click on Manage and then Authorize.

After the Public Key is authorized, you will see that a Private Key has been automatically generated with the same name. Download this private key to your computer. The Private key should not have a file extension. Do not give it one.

If you’re using the default setup, your Private Key will go into your Home/Downloads folder. Navigate to this folder so you can copy the key into the .ssh folder you made earlier.

cd Downloads
cp -frp id_rsa ~/.ssh

Finally, you may need to edit the permissions by using

sudo chmod 600 ~/.ssh/id_rsa

Once your Private Key is in the .ssh folder with updated permissions, you should be able to SSH into your remote web server by using the password you created while making the Key. This is an example of how I would SSH into my shared server at InMotionHosting.com.

ssh -p 2222 username@subdomain.inmotionhosting.com

Or you could also use your direct server IP address found in your cPanel.

ssh -p 2222 username@198.162.1.5
Related Articles