Transferring Data using SFTP and SCP on Elzar

Creation date: 8/1/2023 4:02 PM    Updated: 8/1/2023 4:09 PM   bamdev1 bamdev2 elzar hpc linux ssh

SFTP and SCP are both protocols for transferring files securely between Linux hosts using SSH.

  • SCP can only be used for transferring files and is non-interactive (you can’t create, delete, or manage remote directories or files).
  • SCP is better designed for one-time file transfers and is faster than SFTP for large files.
  • SFTP allows interactive commands (listing, creating, and deleting files and directories).  It also supports resuming interrupted transfers and recursive copying of directories.
  • Both SCP and SFTP are more secure than FTP.

SCP examples

Copy filename.txt from your local system to the directory named documents on bamdev1:
> scp filename.txt user@bamdev1:documents/

Recursively copy a remote directory named backup to the current directory on your local system:
> scp -r user@bamdev2:backup/ .

SFTP examples

To establish an SFTP connection, use the following syntax:
>sftp user@remote-host
sftp> help                      # list of available commands
sftp> get filename              # download file
sftp> put filename              # upload file
sftp> ls                        # list remote directory
sftp> lls                       # list current working local directory
sftp> mkdir                     # create remote directory

Graphical clients

There are several graphical clients that can be used for SSH file transfer that are available on different platforms.  Filezilla is popular solution and is supported on all platforms.

Robert Petkus, 8/1/23