Tuesday, 17 January 2012

Transfer Files From One UNIX Server To Another using scp

In Unix, you can use the scp command to copy files and directories securely between remote hosts without starting an FTP session or logging into the remote systems explicitly. The scp command uses SSH to transfer data, so it requires a password or passphrase for authentication. Unlike rcp or FTP, scp encrypts both the file and any passwords exchanged so that anyone snooping on the network can't view them.

Warning: Be careful when copying between hosts files that have the same names; you may accidently overwrite them.

From Server to Local
Code Snippet
  1. scp -r user@server1:/directory/files /localDirectory
End of Code Snippet

From Local to Server
Code Snippet
  1. scp -r /localDirectory user@server1:/directory/files
End of Code Snippet

No comments: