|
Trick: Secure Copy with SCP |
|
|
|
Tuesday, 17 August 2004 |
Some of you may be familiar with ftp (File Transfer Protocol). It is not a good idea to use ftp over the Internet because it is a relatively insecure method of transfering files between computers. As most of you know, this protocol sends the user's password and data in the clear over the network, which leaves the user information and data susceptible to password sniffing and other network traffic interception.
To transfer files between machines, you need to use scp. scp works very similarly to cp, except that the files you are copying reside on different machines.
To copy a file from a remote computer to the computer you are working at, you type:
scp user@remote-computer:/remote/path/remote-file /local/path/local-file
Or for the whole directory:
scp -r user@remote-computer:/remote/path/remote-directory /local/path/local-directoty
You will then be prompted for the user's password on the remote computer. After you enter it, the file will be copied. For example:
scp
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
:/home/molly/Info/info /home/mwaring/facts
To copy a local file onto a remote computer, you type:
scp /local/path/local-file user@remote-computer:/remote/path/remote-file
Or for the whole directory
scp -r /local/path/local-directory user@remote-computer:/remote/path/remote-directory
For those of you familiar with ftp, this is like 'put local-file remote-file'.
Note: As with cp, you need to have read/execute permissions on the two files. Also, you should only specify one computer name (either the local host or the remote host). This does not work with Windows machines. scp works only between UNIX/Linux machines. |