SSH Secure Copy/ File Transfers
This follows on the ideas I've been putting out about using SSH in the everyday environment of an Administrator. The next use for SSH is to transfer files across a network, either from a remote machine or to a remote machine. SCP (Secure Copy), the SSH version of rcp, can transparently and securly copy files over the SSH protocol. With SSH you can also cpy between two remote systems without having to go through the local machine.
A good reason to transfer files via SSH is to move log files or configuration files from one machine to another machine. A nice added feature of SCP is that jobs can be automated with a Cron job. A key feature of the automated option is that public keys needs to be set up which I'll cover in another day or two.
The basic command looks like this: scp user@remotebox:~/
This will transfer the file listed in file name from the remote box to the local box. The colon after the remote box tells scp where to copy the file to. The ~/ lists the destination on the local box where to copy the file to, the default is the home directory of the user signed in with SSH.
Changing the order of the command will give a different result. Changing the order as thus: scp user@remotebox: /tmp/special This command will copy the file from the user's home directory on the remote machine to the /tmp/special directory on the local machine.
Relative file names resolve differently on the local machine than on the remote machine. On remote machine the /HOME directory is assumed, on the local machine the current directoy is used.
Some common options are:
-p option preserves modification times, access times, and modes from the original file.
-r recursively copy directories
When you specify remote locations in the source and destination, scp will copy from the source to the destination without going through the local host.
To return to the main directory for the SSH tutorials.
A good reason to transfer files via SSH is to move log files or configuration files from one machine to another machine. A nice added feature of SCP is that jobs can be automated with a Cron job. A key feature of the automated option is that public keys needs to be set up which I'll cover in another day or two.
The basic command looks like this: scp
This will transfer the file listed in file name from the remote box to the local box. The colon after the remote box tells scp where to copy the file to. The ~/ lists the destination on the local box where to copy the file to, the default is the home directory of the user signed in with SSH.
Changing the order of the command will give a different result. Changing the order as thus: scp user@remotebox:
Relative file names resolve differently on the local machine than on the remote machine. On remote machine the /HOME directory is assumed, on the local machine the current directoy is used.
Some common options are:
-p option preserves modification times, access times, and modes from the original file.
-r recursively copy directories
When you specify remote locations in the source and destination, scp will copy from the source to the destination without going through the local host.
To return to the main directory for the SSH tutorials.

<< Home