Using SSH with keypairs
This article will show you how to use SSH with keypairs. If you’re on one of our CentOS7 shared hosting solutions, this method must be used to connect to your server via SSH. If you’re struggling, please contact our support team for assistance.
If you have a VPS or dedicated solution, then other methods of SSH authentication are available to you. If you wish to use SSH keys, then you’ll need to install the SSH Keys Manager Plesk Extension.
You’ll also need to ensure that you have PuTTY and PuTTYGen installed on your local machine.
Creating your keypair
Open up PuTTYgen. We’re going to use this to create a key-pair to allow you to connect to your server via SSH.
Ensure that you’ve selected the SSH-2 RSA key type and 2048 bits – these should be default settings.
Now click Generate and have fun moving your mouse around to generate some random content to build the key-pair.
You should now have a private and public key pair generated. For added security, you can specify a passphrase for your key – a password that anyone connecting via this key will need to use. Make sure you keep note of this passphrase.
From here, click Save private key to save your private key to your local machine. Make sure you know where the file is stored and that you can browse to it. It can be called whatever you like, as long as you use the .ppk extension.
Next copy the public key directly from your PuTTYgen window. If you’re on shared hosting. this is the text that you’ll need to request that we add to the server for you, so you’ll need to contact us (email@example.com) requesting this and including the full text of the key.
If you’re not on shared hosting, then you should be able to add this key to the server yourself.
We would also recommend that you save a copy of your public key to your local machine. Click Save public key and ensure that you save it somewhere that you can access easily if you need to.
Connecting to the server
Once Support have confirmed that this key has been added to the server, you can then use PuTTY to connect to the server.
To begin, open up PuTTY. You’ll need to specify your site name as the hostname (assuming that your site points to your Nublue hosting already. If not you should be able to use the IP of your Nublue server).
You’ll also need to ensure that port number 22 is selected and that the Connection type is set to SSH.
Next select the Connection category on the left-hand side and then Data. In the field for Auto-login username you’ll need to enter your FTP username.
If you’re not sure what your username is, you can find it in your Plesk Control Panel under the Web Hosting Access tool.
Select SSH, then Auth. Now you can click Browse… and select the private key that you saved to your machine.
Save your session for future
Browse back to Session and enter a name for your SSH session and click Save.
Now to open up this SSH session now (and in future), you can select the session from the list in PuTTY and click Open.
Upon your first connection, you’ll probably see a security warning. You can accept this warning.
Following this, PuTTY should prompt you to enter the passphrase that you generated earlier for your SSH key. You should now find that you’re connected to your server via SSH.
Try using the pwd command to confirm you’re in the correct location and whoami to confirm which user you are logged in as. You should find that you’re one directory above your httpdocs directory (otherwise known as the webroot folder) and logged in as the default FTP user for your domain.