Difference between revisions of "Copy files to remote server"

From vpsget wiki
Jump to: navigation, search
Line 9: Line 9:
 
Add -r for recursive (copy all directory with subdirs):
 
Add -r for recursive (copy all directory with subdirs):
 
  scp -r -P 22 /path/to/file username@remoteserver.tld:/path/to/remote/directory/
 
  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
  
 
[[Category:Admin area]]
 
[[Category:Admin area]]

Revision as of 06:03, 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