Accessing your Linux shared hosting package using SSH

1

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

How to Enable SSH for your package?

Our servers support SSH access on all Linux (Single Domain, Multi Domain and Reseller) Hosting packages. SSH Access can be enabled for a cPanel Account on request. Get in touch with our Support Team at https://domainindustries.in/support/ to have the access enabled.

How to connect to the hosting package through SSH?

SSH connection to our Linux Hosting Servers will be through a key based authentication.

How do I generate a SSH Key Pair for the key based authentication?

You’ll need to generate the key (public key and private key) pair on your local computer.

 

For Linux OS:
Run the below command on your Terminal:

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 OS:

1.    Download PuTTY & PuTTYgen

2.    Open PuTTYgen

3.    Select the SSH-2 RSA (or SSH-2 DSA) option

4.    Click on Generate

5.    Now move your mouse pointer randomly over the empty space below the progress bar to create a random generated key

6.    Click on Save private Key, 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

 

Authorize the SSH Server to use the Public Key

For Linux:

  • Create a directory as .ssh (note the preceding dot) under /home/<username>/ for your hosting package.
    You will then have to create a file named authorized_keys inside this .ssh directory.
  • Copy the content of the local ~/.ssh/id_dsa.pub or ~/.ssh/id_rsa.pub file into the authorized_keys file.

For Windows:

  • Create a directory as .ssh (note the preceding dot) under /home/<username>/ for your hosting package.
    You will then have to create a file named authorized_keys inside this .ssh directory.
  • Copy the content under the Public-Lines section in the file called ssh_private_key.ppk on your computer.
  • Edit the authorized_keys file on your hosting package, type the word ssh-rsa (including spaces on both ends of the word) and paste the copied content. Remove the carriage return at end of each line, merging four lines into one single line. Be careful not to delete any characters while doing that. Final output would be similar to:
  • ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAnjXf5VEuIfOHmbNGn7NZAYDjSp8mYK9sDF+RZR75V4gyu3FeaXcAlwA/jwzzgpIvhK2why5t9DtokyInlocq
    P9SbNd9xOnrvXEV+ImvKiBf4+tFk7uagZJ+CLrr0tK7M4lKskjfad38UF5cJ0+YU24V1sCDs6QTJC4kG3PO1eeE=

You’ve just setup the SSH Key Pair for key based authentication

Now that you have done this, you are all good to access your hosting package using SSH, Here’s how you can do it:

For Linux:

Run the below command:

ssh -l user remote-server-host-name

 

For Windows:

1.    Open Putty and enter the hosting package IP Address or Host Name.
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 via SSH

That’s it the black screen in front of you is all yours to access your web hosting package using SSH.

1

Now move your mouse pointer randomly over the empty space below the progress bar to create a random generated key

2

  1. Click on Save private Key, without providing any passphrase

3

  1. Click Yeson the window asking for confirmation for saving the key without a password.

4

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

 

Authorize the SSH Server to use the Public Key

For Linux:

  • Create a directory as .ssh (note the preceding dot) under /home/<username>/ for your hosting package.
    You will then have to create a file named authorized_keys inside this .ssh directory.
  • Copy the content of the local ~/.ssh/id_dsa.pub or ~/.ssh/id_rsa.pub file into the authorized_keys file.

For Windows:

  • Create a directory as .ssh (note the preceding dot) under /home/<username>/ for your hosting package.
    You will then have to create a file named authorized_keys inside this .ssh directory.
  • Copy the content under the Public-Lines section in the file called ssh_private_key.ppk on your computer.

5

  • Edit the authorized_keys file on your hosting package, type the word ssh-rsa (including spaces on both ends of the word) and paste the copied content. Remove the carriage return at end of each line, merging four lines into one single line. Be careful not to delete any characters while doing that. Final output would be similar to:
  • ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAnjXf5VEuIfOHmbNGn7NZAYDjSp8mYK9sDF+RZR75V4gyu3FeaXcAlwA/jwzzgpIvhK2why5t9DtokyInlocq
    P9SbNd9xOnrvXEV+ImvKiBf4+tFk7uagZJ+CLrr0tK7M4lKskjfad38UF5cJ0+YU24V1sCDs6QTJC4kG3PO1eeE=

You’ve just setup the SSH Key Pair for key based authentication

Now that you have done this, you are all good to access your hosting package using SSH, Here’s how you can do it:

For Linux:

Run the below command:

ssh -l user remote-server-host-name

 

For Windows:

Open Putty and enter the hosting package IP Address or Host Name.

6

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

7

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

8

 

  1. Click the Openbutton to connect to the server via SSH

That’s it the black screen in front of you is all yours to access your web hosting package using SSH.

 

0 Likes
0 Dislikes
1166 Views