If you have ssh server running on a machine ,you can transfer files to/from it to any other machine connected over a network to it. The open-ssh server suite provides a utility named scp. Here are some examples of useful scp usage
Copy myfile to server
( ubg is my username on server1. You can replace server1 with an IP address or domain name. If the user names on the local machine and the remote server are the same you can omit it. See examples below.)
$ scp myfile ubg@server1:/tmp/
Password: ******
Copy remote myfile to local working dir
$ scp server1:/tmp/myfile /home/ubg/myfile
Password: ******
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/
To do recursive copies, from a particular point in the remote file system, use the
-r option:
$ scp -r mydir ubg@server1:/tmp/
The above command will copy all mydir to remote /tmp
No comments:
Post a Comment