This is an old revision of the document!
scp
Control flow
- On client (copy remote to local case)
- construct
scpcommand to be executed on the server via ssh. append-v -r -p -dflags as appropriate. Resulting command stored incmdvariable - call
toremote()if destination is remote;tolocal()if destination is local (handles 'remote to local' and 'local to local' cases) - for 'remote to local' case, append
'-f <src>' toscpcommand to be run on the server - call
do_cmd()to run assembledscpcommand on the server do_cmd()forks a child which executes (viaexecvp()) “ssh -p <port> -l <remuser> — <host> <cmd>” scp command on the server. Connect parent and child via pipes.do_cmd_pidcontains child's PID.
- On server
- for
-tor-fprivate flags:remin = stdin;remout = stdout
