SSH – Copy files from one server to another

Fastest way to copy files from  one server to another is using SSH scp command, it’s fairly straightforward. If you are not familiar with SSH please be careful, as you might copy over files to wrong directory and override some important files. Always double check source and target paths.

Open SSH session from target server

scp -r {{username}}@{{server_ip}}:{{source_path}}*  {{target_path}}

One you run this command you will have to enter FTP password of source server. After that you will see that files started to copy over. Once it’s done, you will be able to write your next command.

Real e.g.:

scp -r nutmedia@127.0.0.1:webapps/my_website/*  /home/webapps/my_website

Please feel free to write comment if need some clarification.

Nathan

Share