O'Reilly logo

SSH, The Secure Shell: The Definitive Guide, 2nd Edition by Robert G. Byrnes, Richard E. Silverman, Daniel J. Barrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Secure Copy with scp

The secure copy program, scp, obeys keywords in your client configuration file just as ssh does. In addition, scp provides other features and options that we’ll cover in this section. Remember that scp supports several options for logging and debugging, so you can watch what’s going on when it runs. [7.3]

7.5.1 Full Syntax of scp

So far, we’ve described the syntax of scp only in general: [2.2.1]

    scp name-of-source name-of-destination

Each of the two names, or path specifications, on the command line represents files or directories in the following manner (it is fairly consistent with the behavior of Unix cp or rcp):

  • If name-of-source is a file, name-of-destination may be a file (existing or not) or a directory (which must exist). In other words, a single file may be copied to another file or into a directory.

  • If name-of-source is two or more files, one or more directories, or a combination, name-of-destination must be an existing directory into which the copy takes place.[115] In other words, multiple files and directories may be copied only into a directory.

Both name-of-source and name-of-destination may have the following form from left to right:

  • The username of the account containing the file or directory, followed by @. This part is optional, and if omitted, the value is the username of the user invoking scp.

  • The hostname of the host containing the file or directory, followed by a colon. This part is optional, if the path is present, and the username isn’t; if ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required