The Relationship Between File Transfer, SSH, SCP2 (SCP), and SFTP.
A Brief Introduction to SSH
The SSH protocol provides strong
encrypted authentication and a secure encrypted tunnel through which you can
move data and execute remote commands securely.
There are two different and
incompatible implementations of the SSH protocol; SSH-2 and SSH-1. While the
Reflection Windows clients support both protocols, it is highly recommended
that you use the newer protocol, SSH-2, rather than SSH-1, which is deprecated.
The Secure File Transfer Utilities
The file transfer capabilities of
SSH are provided by utilities included with most SSH products, such as
Reflection and the Reflection for Secure IT Windows and UNIX Clients.
Typically, these utilities are called scp and sftp.
The scp and sftp utilities use the
SCP and SFTP protocols (respectively) to provide file transfer capabilities and
use the encrypted SSH tunnel to provide security.
SCP (Secure Copy Protocol) is
part of the OpenSSH suite of tools. Basically it's an encrypted/strongly
authenticated version of rcp.
Problem using scp:
I issued an command on a local
machine
scp -r download/ tim@foo.xxx.xxx.xxx
Then I checked at the remote
foo.xxx.xxx.xxx and found under my home directory.
Sol/ Colon is missing at the end, it
should be scp -r download/ tim@foo.xxx.xxx.xxx:. The colon shows you're
transferring to a remote host and not just a local file called
tim@foo.xxx.xxx.xxx.
Important distinction: The file
transfer protocol SFTP is not a 'secure version' of the standard FTP protocol.
It is a completely different protocol. You cannot connect to an FTP server
using SFTP or to an SFTP server using FTP.
See this Link in detail.
There are two ways that scp
utilities can implement file transfers; one implementation is based on OpenSSH
and uses SCP over SSH, the other uses SFTP over SSH.
The following sections detail what
happens in the background when scp based on OpenSSH (using SCP over SSH) or
scp/sftp (using SFTP) are used.
Transferring Files Using scp / sftp
(using SFTP)
When an sftp or scp (using SFTP)
command is issued, the following occurs:
The command opens the sftp command
line interface.
It runs the ssh command with the –s
option to start an sftp subsystem.
It sets up a secure tunnel and
securely authenticates.
It starts the host SSH daemon's
sftp-server subsystem (the file transfer server).
And it waits for interactive sftp
commands.
The SSH tunnel remains open until
the bye command is issued, allowing multiple sftp commands to be issued before
it is closed.
Transferring Files Using scp Based
on OpenSSH (using SCP over SSH)
When an scp command is issued, the
following occurs:
scp starts ssh with the specified options
and the remote command to execute scp on the remote host. This initiates an SSH
connection, sets up an encrypted tunnel, and securely authenticates to the SSH
server.
scp executes on the server, using
the -t (uploads) or -f (gets) options.
scp transfers the specified file(s)
or folder(s), using the SCP protocol.
Once the transfer is complete, the
SSH tunnel is closed.
A new SSH tunnel is created and shut
down for each scp command issued.
Comments
Post a Comment