8.2.2.4. Secure copy (SCP)
Another option for transferring files between two computer with SSH is using the command
scp
. This attempts to use the same syntax as the tradition copy command (
cp
), but differs in that you can specify remote servers. For example, to send a file to a remote server, type
$ scp
localFile
user@server:/destination/directory/
You can similarly fetch a file:
$
scp
user@server:/path/to/wantedfile destinationFile
Or even between two remote servers:
$ scp
user1@server1:/path/to/source
user2@server2:/path/to/destination
In every case that you access a remote server, you will be prompted for your credentials (such as a username and password).