Saturday, February 19, 2011

SSH

SSH : is know as secure shell used to secure remote login over insecure network.
You can login to other machine, assuming ssh server is running on machine you want to login.
1> install ssh (sudo apt-get install ssh)
2>remote login:
     - Let us say remote system is: bharatj@nsl-32.cse.iitb.ac.in or bharatj@ipaddress
     - Write on terminal as follows:
     - ssh bharatj@nsl-32.cse.iitb.ac.in
     - Ask for password (enter your remote system password)
     - Now you are on remote machine which can be seen as
     - bharatj@nsl-32$ (terminal prompt)
     - Now you can browse through the contents using cd etc commands.

Copying file from remote machine to local machine:
1>Write command on terminal as follows:
     scp bharatj@nsl-32.cse.iitb.ac.in:sourcepath/source-file destination-path
     For ex: source path is /users1/pg09/bharatj/Desktop
                 source file is tracker.c
                 destination path /home/bharatj/Desktop
     So after this tracker.c will be copied on local machine on desktop location.

                     
Copying directory from Remote machine to Local machine:
1> Write on terminal :
      scp -r bharatj@nsl-32.cse.iitb.ac.in: /users1/pg09/bharatj/Desktop/experiment /home/bharatj/Desktop
     This will copy directory experiment from remote machine to local machine on Desktop.

Note: scp -------------- for file transfer
          scp -r -------------for directory

Copying file from Local machine to Remote machine:
1> scp file.pdf bharatj@nsl-32.cse.iitb.ac.in:/users1/pg09/bharatj/Desktop
      This will copy file file.pdf from Local machine to remote machine on Desktop.

Copying directory from Local to Remote Machine:
1>scp -r MTP bharatj@nsl-32.cse.iitb.ac.in:/user1/pg09/bharatj/Desktop
    This will copy directory MTP from local machine to Remote machine Desktop.



NOTE: # For scp donot do ssh first, just directly do scp.
            # For displaying Remote machine file without copy into Local machine:
                ssh -X bharatj@nsl-32.cse.iitb.ac.in
                Let us suppose you want to see file.c
                gedit file.c & will display file.c


No comments:

Post a Comment