Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
projects:openssh [2019/12/25 15:39]
admin [On client]
projects:openssh [2019/12/25 16:34] (current)
admin [1) scp run on client (copy remote to local case)]
Line 1: Line 1:
 ====== scp ====== ====== scp ======
-===== Control flow ===== + 
-  * On client: +==== 1) scp run on client (copy remote to local case) ==== 
-    * ''​remin = stdin'';​ ''​remout = stdout''​+    * construct ''​scp''​ command to be executed on the server via ssh. append ''​-v -r -p -d''​ flags as appropriate. Resulting command stored in ''​cmd''​ variable 
 +    * 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>'''​ to ''​scp''​ command to be run on the server 
 +    * call ''​do_cmd()''​ to run assembled ''​scp''​ command on the server 
 +    * ''​do_cmd()''​ forks a child which executes (via ''​execvp()''​) "''​ssh -p <​port>​ -l <​remuser>​ --- <​host>​ <​cmd>''"​ scp command on the server. ​ Connect parent and child via pipes. Parent accesses child'​s pipes via ''​remin''​ & ''​remout''​. ''​do_cmd_pid''​ contains child'​s PID. 
 +    ​''​tolocal()->​sink()''​ receives file from child via ''​remin''​ & ''​remout''​ and stores it to the local destination 
 +    * finaly wait for child to finish, check for errors, close ''​remin''​ & ''​remout''​ and exit 
 +==== 2) client ​runs ssh to spawn server side of scp ==== 
 +==== 3) server accepts ssh connection from client ==== 
 +    * for ''​-t''​ or ''​-f''​ private flags: ​''​remin = stdin'';​ ''​remout = stdout''​
projects/openssh.1577284768.txt.gz · Last modified: 2019/12/25 15:39 by admin
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0