SSH Access

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

cxwz supports SSH access on all its Linux (Single Domain, Multi Domain and Reseller) Hosting Servers. SSH connection to cxwz's Linux Hosting Servers can be through key or password based authentication.

Connecting to a Server through SSH using Password authentication

For Linux:

  1. Run the below command:

    ssh -l user remote-server
  2. Enter the cPanel password.

For Windows:

  1. Open Putty and enter the Remote Host Name or IP Address.

     

  2. 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

 

  1. Login to the cPanel of the domain for which you wish to generate the key pair.

  2. Click on SSH Shell Access under the Security section.

  3. Click on Manage SSH Keys.

  4. Click on Generate a New Key.

  5. Enter the key name and password and click on Generate Key.

Note

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:

  1. Download PuTTY.

  2. Download PuTTYgen.

  3. Open PuTTYgen.

  4. Select the SSH-2 RSA (or SSH-2 DSA) option and click the Generate button.

  5. Move mouse randomly over the empty space below the progress bar to create some randomness in the generated key.

  6. Click the Save private Key button, without providing any passphrase.

  7. Click Yes on the window asking for confirmation for saving the key without a password.

  8. Save the key file with an appropriate name, say ssh_private_key.ppk.

  9. 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.

  1. Click on Manage Authorization for the key you wish to authorize.

  2. Click on Authorize to authorize the key.

Accessing the Remote Server

For Linux:

Run the below command:

ssh -l user remote-server

For Windows:

  1. Open Putty and enter the Remote Host Name or IP Address.

     

  2. In the left menu, click Data under Connection and enter the cPanel username in the Auto-login username field.

     

  3.  

    In the left menu, click Auth under Connection -> SSH and enter the path of the saved private key file.

  4. Click the Open button to connect to the server.