DEV Community

Cover image for Securely Transfer Files with SFTP

Securely Transfer Files with SFTP

WebDevQuest on October 14, 2017

SFTP (Secure File Transfer Protocol) is similar to FTP (File Transfer Protocol) in that is allows you to transfer files between your local machine ...
Collapse
 
bgadrian profile image
Adrian B.G. • Edited

Nice!

If you use Linux/Mac (or Bash on windows) I suggest trying SCP, it has a very simple syntax and if you are already using SSH you already know how to use it (it has many common parameters).

The advantage is that you do not need an extra server/service like FTP.

#Copying file to host:
scp SourceFile user@host:directory/TargetFile
#Copying file from host:
scp user@host:directory/SourceFile TargetFile
scp -r user@host:directory/SourceFolder TargetFolder

Enter fullscreen mode Exit fullscreen mode

For file synchronization see rsync, used for more complex scenarios (ex copy only the missing files, or the newer ones).