Search blog

Tuesday, January 19, 2016

Steps for Creating SSH Connection in Ubuntu 14.04

1. First you should generate an SSH key pair on your Linux distribution. Open up your terminal and execute the following commands:

 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): (just press Enter here)  
 Enter passphrase (empty for no passphrase):  
 Enter same passphrase again:  
Once you've entered the passphrase you will see the following message as below:
 Your identification has been saved in id_dsa.  
 Your public key has been saved in id_dsa.pub.  
 The key fingerprint is:  
 16:8e:e8:f2:1d:c9:b9:cf:43:9a:b3:3c:c1:1f:95:93 user@localhost  

This will create a private key written to /home/user/.ssh/id_dsa and a public key written 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.

2. If you are using cPanel then log into it and open the SSH section. Then open the file 'id_dsa.pub' in a text editor like Gedit. The file will be located at '/home/user/.ssh/id_dsa.pub.' The '.ssh' directory might be hidden so press 'CTRL+H' to view hidden files & folders. Select ALL & COPY the content of the file inside the box with the label 'Public Key (DSA only):' Look at the image below.



3. Logging in to your Web Hosting account via SSH in Linux:

 user@localhost: ssh-add /home/user/.ssh/id_dsa  
 Enter passphrase for id_dsa:  
 Identity added: id_dsa (id_dsa)  

(The passphrase is the same as the one you have set during the generation of the SSH key in Step 1).

Then you should initiate an SSH connection:

user@localhost: ssh USER@HOST_NAME -pPORT

  • USER - the user for which you want to establish the SSH connection; this will be the same username as the one you use to log in to your cPanel.
  • HOST_NAME (or IP address) - here you should enter the host/IP of the server to which you wish to connect (e.g. siteground300.com);
  • PORT - the port for the connection - here you should enter the port provided by your Web Host; try something like -p18765
Press "Enter" and if everything has been set up properly, you will establish an SSH connection to your account.

No comments:

Post a Comment

Thank you for your Feedback!
www.evagabond.me

Top 5 Posts (Weekly)