Prior you begin to enable SSH on a
Linux based dedicated server, create a pair of SSH key using the ssh-keygencommand. Remember, you are required to run this connection in the command line. Moving ahead, you need to determine the file where the generated SSH keys can be saved, providing a password to it.
To simply understand the process, have a look at the below given example:Client@localhost: ssh-keygen -t dsa
Creating public/private dsa key pair
Enter the file wherein you wish to save the pair of SSH keys
Now, enter password
Re-enter the password
Note: Your public key will be saved in id_dsa.pub and id_dsa.
Thereafter,
Private Key is written to /home/user/.ssh/id_dsa
Public key is written to /home/user/.ssh/id_dsa.pub
Here, you will be asked a passphrase to enter in order to protect your key. Moreover, the IP address that you have utilized to order your dedicated server gets automatically stored in the server’s firewall. If you are seeking to create WHM and SSH connections by making use of
different IP addresses – you need to add that in the firewall. Apart from this, access from your IP address is needed to be permitted for the SSH port on the dedicated server. This, you can do by posting a ticket in the Port Opening Request category.
Once you are done with public and private SSH keys generation, add the public key through your Web Host Manager (WHM) by following the below mentioned steps:- Sign in to your dedicated server's WHM panel as root
- Go to Manage SSH Keys located in the Security section
- Hit on the Import Key button
- Enter a name and a password for the key
- Enter your public key
- Press Import to import your key
This will now enable you to connect to your
Dedicated Server via SSH.
Now, enter your private key by following the below mentioned commands:
client@localhost: ssh-add /home/user/.ssh/id_dsa
Enter password that you have created at the beginning for id_dsa:
Identity added: id_dsa (id_dsa)
Immediately after you enter the password, you are allowed to establish an SSH connection.
client@localhost: ssh <CLIENT>@<HOSTNAME> -p<PORT>
Client – root – an end-user for whom you wish to establish a SSH connection
HOSTNAME (or IP address) - You need to enter the dedicated server’s hostname/IP.
PORT – It is the port for the connection;
Once you have filled up all the details, press Enter.