scp, the secure version of cp, aka copy, is pretty great, since it is straightforward to copy one or more files or directories from any one machine to any other machine (and the command could be running on a third machine).
Note: it is best to use sudo, and full paths for everything.
Second note: for using a private key at the destination, declare that first, and then the local or login+remote file(s).
- optional -r for recursive directory structure
- optional -i for optional identity file aka private key
- Use the full path for the identity file (this file needs to be local to the machine on which scp is being run
- either a [email protected]: or a /local/directory/file for the source
- Note that there is no slash after the colon before the first directory name on a remote location
- either a [email protected]: or a /local/directory/file for the destination