Difference between revisions of "Copy files to remote server"

From vpsget wiki
Jump to: navigation, search
Line 13: Line 13:
  
 
  rsync --partial --progress --rsh=ssh user@host:remote_file local_file
 
  rsync --partial --progress --rsh=ssh user@host:remote_file local_file
 +
or
 +
rsync -avz -e ssh remoteuser@remotehost:/remote/path /local/path
  
 
[[Category:Admin area]]
 
[[Category:Admin area]]

Revision as of 06:05, 1 July 2015

How to copy files to remote server using command line

1. Rsync. We are assuming that the ssh keys are already configured.

rsync -av -e 'ssh -p22' /path/to/file IP:/path

2. Scp

scp -P 22 /path/to/file username@remoteserver.tld:/path/to/remote/directory/

Add -r for recursive (copy all directory with subdirs):

scp -r -P 22 /path/to/file username@remoteserver.tld:/path/to/remote/directory/

If you wan to resume broken scp transfer try with rsync:

rsync --partial --progress --rsh=ssh user@host:remote_file local_file

or

rsync -avz -e ssh remoteuser@remotehost:/remote/path /local/path