05 October, 2010

Copying Remote Files with scp



To use scp to transfer files, the SSH service (usually the sshd server daemon) must be running on the remote system. Here are some examples of useful scp commands:






$ scp myfile francois@server1:/tmp/ 
Password: ******
Above code copies myfile to server1


$ scp server1:/tmp/myfile 
Password: ******
Copy remote myfile to local working directory. Use the -p option to preserve permissions and timestamps on the copied files:

$ scp -p myfile server1:/tmp/If the SSH service is configured to listen on a port other than the default port 22, use -P to indicate that port on the scp command line:

$ scp -P 12345 myfile server1:/tmp/
 
Connect to a particular port.To do recursive copies, from a particular point in the remote file system, use the -r option:

$ scp -r mydir francois@server1:/tmp/ 
Copies all mydir to remote /tmp .Although scp is most useful when you know the exact locations of the file(s) youneed to copy, sometimes it’s more helpful to browse and transfer files interactively.

0 comments:

Post a Comment

speak out... itz your time !!!

 

Terminal Diary | techblog Copyright © 2009 Gadget Blog is Designed by jintu jacob Powered by Blogger