[NBLUG/talk] Syntax of scp

Mitch Patenaude mrp at sonic.net
Sun Feb 29 07:59:00 PST 2004


scp has an argument structure that is (purposefully) the same (or 
really a subset) as that of rcp.  It was thought of as a drop-in 
replacement.

So.. the syntax for destination (or source) files is

[[user@]hostname:]path

without the syntactic key of the :at the end, the parser was treating 
it just like a filename since 192.168.0.12 is valid file name.  If 
neither of the source and destination are "remote", it behaves just 
like cp.

And you can specify multiple sources and one destination, all on 
different machines, e.g.:

scp calisto:index.html john at europa:/tmp/logo.png 
widgets at www.example.com:public_html/NewProducts/.

If you specify more than one host.. the authentications happen in the 
order they appear on the command line.  I like to set up 
$HOME/known_hosts with keys so that authentication is automatic, but it 
will fall back on password authenication.

Something else to note:  If there is no path, or if the path is 
relative, then it's interpreted as relative to the home directory of 
the user.  If the file isn't in the home dir, you can use an absolute 
path.

   -- Mitch




More information about the talk mailing list