How to Enable SSH for Dedicated Server on Linux ?
Following steps could be referred :
a.You will have to generate ssh key pairs for your connection .
b. You can do so using the ssh-keygen command. You should run it on the command prompt. You will be asked for a file where the key should be saved .And also for a password for the key. Below is an example:
user@localhost: ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_dsa.
Your public key has been saved in id_dsa.pub.
The key fingerprint is:
This will create a private key saved/stored to /home/user/.ssh/id_dsa and a public key saved to /home/user/.ssh/id_dsa.pub. The passphrase is used to protect your key. You will be asked for it when you connect via SSH.
Initial ip address is already added to server firewall. If you want to use another ip address for SSH and whm access, then you should request it to be added in the firewall
c.Once you have generated your public and private SSH keys, you should add the public key through your WHM. For that, log in to your WHM admin panel and go to Manage SSH Keys located in the Security section. Click the Import Key button. Type in a name and a password for the key and paste your public key in the corresponding field. Here you don’t paste your private key. Click Import to import your key.
You can now ssh to your Dedicated Server.
d. You should load your private SSH key using the following command:
user@localhost: ssh-add /home/user/.ssh/id_dsa
Enter passphrase for id_dsa:
Identity added: id_dsa (id_dsa)
(The password is the same as the one you have set during the generation of the SSH key.)
Once you have entered the passphrase you can initiate an SSH connection:
user@localhost: ssh <USER>@<HOSTNAME> -p<PORT>
- <USER> – root – the user for which you want to establish the SSH connection. Since your account is hosted on a dedicated server you can login using the “root” account
- <HOSTNAME> (or IP address) – here you should enter the hostname/IP of the Dedicated Server.
- <PORT> - the port for the connection;
Press “Enter” and if its all correct, you will establish an SSH connection to your account.