What is Secure Shell (SSH)?
Secure Shell (SSH) is a cryptographic network protocol for secure data communication, remote shell services or command execution and other secure network services between two networked computers that connects, via a secure channel over an insecure network, a server and a client (running SSH server and SSH client programs, respectively). SSH is typically used to log into a remote machine and execute commands. It can transfer files using the associated SSH file transfer (SFTP) or secure copy (SCP) protocols. The standard port used to connect through SSH is 22.
Enabling SSH Access
Trance Host supports SSH access on all its Linux (Single Domain, Multi Domain and Reseller) Hosting Servers. SSH connection to Trance Host's Linux Hosting Servers can be through key or password based authentication.
Connecting to a Server through SSH using Password authentication
For Linux:
-
Run the below command:
ssh -l user remote-server
-
Enter the cPanel password.
For Windows:
-
Open Putty and enter the Remote Host Name or IP Address.
-
Click Open and enter the cPanel username and password.
Connecting to a Server through SSH using Key based authentication
Generating a SSH Key Pair
You can generate the key pair (public key and private key) from the cPanel or your local computer.
cPanel
-
Login to the cPanel of the domain for which you wish to generate the key pair.
-
Click on SSH Shell Access under the Security section.
-
Click on Manage SSH Keys.
-
Click on Generate a New Key.
-
Enter the key name and password and click on Generate Key.
The private key needs to be stored on your local computer.
- For Linux, copy the key file to your ~/.ssh folder.
- For Windows, save the key file to a safe location.
Local Computer
For Linux:
Run the below command:
ssh-keygen -t dsa
OR
ssh-keygen -t rsa
The output would be similar to:
Generating public/private dsa key pair. Enter file in which to save the key (~/.ssh/id_dsa): Press [Enter] key Enter passphrase (empty for no passphrase): Press [Enter] key Enter same passphrase again: Press [Enter] key Your identification has been saved in ~/.ssh/id_dsa Your public key has been saved in ~/.ssh/id_dsa.pub The key fingerprint is: <some string>
OR
Generating public/private dsa key pair. Enter file in which to save the key (~/.ssh/id_dsa): Press [Enter] key Enter passphrase (empty for no passphrase): Press [Enter] key Enter same passphrase again: Press [Enter] key Your identification has been saved in ~/.ssh/id_dsa Your public key has been saved in ~/.ssh/id_dsa.pub The key fingerprint is: <some string>
id_dsa or id_rsa is the private key and id_dsa.pub or id_rsa.pub is the public key.
For Windows:
-
Download PuTTY.
-
Download PuTTYgen.
-
Open PuTTYgen.
-
Select the SSH-2 RSA (or SSH-2 DSA) option and click the Generate button.
-
Move mouse randomly over the empty space below the progress bar to create some randomness in the generated key.
-
Click the Save private Key button, without providing any passphrase.
-
Click Yes on the window asking for confirmation for saving the key without a password.
-
Save the key file with an appropriate name, say ssh_private_key.ppk.
-
Upload the public key to the hosting server from the cPanel, using the Import Key option
Authorize the SSH Server to use the Public Key
Or Deauthorize to deauthorize it.
-
Click on Manage Authorization for the key you wish to authorize.
-
Click on Authorize to authorize the key.
Accessing the Remote Server
For Linux:
Run the below command:
ssh -l user remote-server
For Windows:
-
Open Putty and enter the Remote Host Name or IP Address.
-
In the left menu, click Data under Connection and enter the cPanel username in the Auto-login username field.
-
In the left menu, click Auth under Connection -> SSH and enter the path of the saved private key file.
-
Click the Open button to connect to the server.