Thursday, 18 April 2013

Steps for Connecting to the Remote Servers



 Pre-requisite:

1. Download the PuTTYgen and PuTTY from the URL: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
2. Generate the SSH Key Pair (Public Key & Private Key) using PuTTYgen by following the steps mentioned at URL:
3. Save the Public Key and Private Key. Public key needs to be on the server that you want to connect to and Private key is to be used on the system that you are using to connect to remote server.
Settings to be done in Putty: 

1. Sessions Settings
Host Name (or IP Address): builduser@build4.appcentral.com
Port: 22
Connection Type: SSH
2. Then goto Connection >> SSH >> Tunnels
Add new forwarded port:
Source port: 3306
Destination: localhost:3306
Click on the "Local" radio button.
Click "Add"
3. Then goto Connection >> SSH >> Auth
Browse the Private Key in the field: Private Key file for Authentication
4. Go back to Session settings, type a name for Saved session and click "Save". Then click "Open"

From Next time just need to select the saved session and then click on Load then Open OR simply double click on the session name to get connected.

Getting the Logs on the server: 
  1. Navigate to directory: /opt/ac/tomcat/logs/catalina.out
  2. Write a command : ‘tail –n 1000 catalina.out >> Logs’ – (This command will get you the last 1000 lines from Catalina.out and will copy into a file named Logs and save it to the current directory)
  3. Now use command cat <filename> to read the contents of the files. In this case it should be ‘cat Log’
 Other commands that can help : 
  1. To move one folder back: cd ..
  2. To see the files and folders in a particular directory: ls OR ls –l
  3. To get inside a folder: cd <foldername>
  4. To remove the files/folders: rm <file/foldername> 
Using WinSCP for fetching the files from Remote (Linux server) server to your local system. 
  1. Download and Install WinSCP using the URL: http://winscp.en.softonic.com/universaldownloader-launch
  2. Provide the Host Name as Provided in Putty configuration and Upload the Private Key (the one used in Putty configuration)
  3. Then Connect.