Sunday, 2 October 2011


ItIt refers to ways of transfering files over an insecured network like interenet in a secured way.There are two protocols through which data can be transferd in a secured way  are:
1) scp
2) sftp
scp and sftp both use ssh(secure shell) for data transfer and utilize the same mechanism for authentication.


1)   SCP can only be used for transferring files, and it is non-interactive (i.e., everything has to be specified on the command line).SFTP is more elaborate, and allows interactive commands to do things like creating directories, deleting directories and files (all subject to system permissions, of course), etc.
2) Although both SCP and SFTP utilize the same SSH encryption during file transfer, SCP is usually much faster than SFTP at transferring files, especially on high latency networks. This happens because SCP implements a more efficient transfer algorithm, one which does not require waiting for packet confirmations. This leads to faster speed but comes at the expense of not being able to interrupt a transfer, so unlike SFTP, SCP transfer cannot be cancelled without terminating the session.


Secure Shell (SSH) is a network protocol for secure data communication, remote shell services or command execution and other secure network services between two networked computers that it connects via a secure channel.The best-known application of the protocol is for access to shell accounts on unix like operating systems. It was designed as a replacement for Telnet and other  remote shell protocols such as the Berkele rsh and rexec protocols, which send information, notably passwords , in plaintexts , rendering them susceptible to interception and disclosure using packet analysis .The encryption used by SSH is intended to provide confidentiality and integrity of data over the network.

## NOW let’s try out ssh in linux in command line interface:-
First we should check whether we have ssh installed or not.
The required command to check this out is
dpkg  -s  SSH
This will check whether ssh is installed or not.If not ,type

Sudo apt-get install ssh

To install the necessary components.
Then for ssh , we need to one computer as the server and    the other as the client.Server is actually the host and client is the one which sends requests to the host.

Command to set up server:

sudo apt-get install opensshserver

Command to set up client:

sudo apt-get install opensshclient

The basic commands for doing SSH  in linux are:
For ssh:
ssh  <username>@<ipaddress of remote host>

First we enter the required ssh command. The system then asks us for the password of the remote host. Enter the password and you’ll  be able to read all the files and folders of the host.

To stop the ssh server type:
             sudo /etc/init.d/ssh stop
To restart the ssh server type:
              sudo /etc/init.d/ssh restart

Now we come to scp:

The SCP protocol is a network protocol which supports file transfers between hosts on a network. SCP uses secure shell (SSH) for data transfer and utilizes the same mechanisms for authentication, thereby ensuring the authenticity and confidentiallity of the data in transit. A client can send (upload) files to a server, optionally including their basic attributes (permissions, timestamps).

Let’s try out scp in linux in command line interface:

For scp:


scp  <full path of the file >  <hostname>@ipaddress of host:target(where we want the file to get copied)

This is the required scp command to send a file named from  the client’s desktop to  remote host’s desktop. we just need to specify the path of the file. if we do not specify the target after ip address then the file is copied in the home folder.

This  screenshot shows the successful transfer of the file in remote host’s computer.
Now we’ll learn how to copy a file from remote host to our system:
The required command is:
Scp  -r  username@ipaddress<file which we want to copy><where we want it to get copied>

This is the required command in which we first need to enter the file name which we want from the remote host and then the folder’s path where we want the file.

Scp command to transfer files between two remote hosts:
scp [options] [[user@]host1:]filename1 ... [[user@]host2:]filename2
for example, let there be two remote hosts, named and a person is working on another computer, but wanted to copy a file called file1.txt from home directory on to a directory called somedir  on, he would enter:

type ‘exit’ in the end to fully get out of the remote host.

Now we do scp in linux through GUI and the tool used is filezilla:-
Filezilla is the tool for transferring files over the network in GUI .it supports all the three operating systems : windows, linux and mac .

To use filezilla in linux do the following: 

2)Click “Download Filezilla Client, All Platforms”

1)First download and install FTP client program. filezilla can be found at
3)select linux as the operating system and download the software.
4) then go to applications>internet>FTP client

There are thus two ways to do the sftp:

1)just enter host, username,password,port and click on quickconect.
2)the other is :

Click on file >site manager
following window will come up
Enter host,port=22 for sftp
In logontype enter ‘normal’.then enter the other login details.
Finally click on connect
Then comes a window whose left side shows our own PC and  right hand side shows the  remote pc. we can double click on the files and folders in the remote host list to see them.
Then to transfer files from our pc to the remote host simply select the file of the left hand side and drag it to the right hand side. depending on how large our file is and how much data are we transferring ,we may need to wait for sometime. we can then rename it or delete by just right clicking on it.

That’s it
We have transferred our file to a remote host.

Now we use WINSCP tool for doing GUI in windows

software named WINSCP ,this allows us to do SFTP and SCP in windows in GUI(Graphical User Interface).
Click on the WINSCP icon .the following icon will pop on RUN.

The following window opens up on clicking on RUN.

Enter the IPaddress, username and password for the remote host. Then we select the file protocol i.e. whether we want to do SFTP or SCP etc. and then click on login.

The following window opens up as we click on login.the left hand side shows our computer’s files and the right hand side shows remote hoste’s files.

Click on OK in the following window to terminate the application.

ssh, scp etc. can be done in windows in command line interfce through a tool named cygwin.
Cygwin is a Unix-like environment and command line interface for microsoft windows Cygwin provides native integration of Windows-based applications, data, and other system resources with applications, software tools, and data of the Unix-like environment. Thus it is possible to launch Windows applications from the Cygwin environment, as well as to use Cygwin tools and applications within the Windows operating context.

No comments:

Post a Comment