How is SCP (secure copy protocol) file transfer working? [closed]

拈花ヽ惹草 提交于 2019-11-29 22:31:13

问题


Please, tell me how SCP work. Can anybody explain(or show) SCP file transfer to me (something look like picture, flow or reference). & one more question. What're difference between SCP and SFTP file transfer ?

Thank you anyone for assist. And sorry about my language.


回答1:


The SCP client connects to the SSH server and executes scp command there. In most cases, the remote scp would be the OpenSSH scp command. That means, if you use the OpenSSH scp command as a client, the local scp (as a client) actually talks to the same program on the server. The remote scp is executed with undocumented -t (to) or -f (from) flags. This way, the scp program recognizes that it serves as a server.

Once the remote scp is running, it talks with the local SCP client (the scp or another implementation) using a simple protocol.

An SCP command is one-letter followed by some arguments and new-line.

An SCP response is one byte, with 0x00 = ok, 0x01 = error, 0x02 = fatal error (though the OpenSSH scp actually never responds with 0x02). The error code is followed by an error message (terminated with a new-line).

It's always the source side that feeds the commands. The target side consumes them. I.e. when downloading, the server feeds the commands and the client consumes them. When uploading, the client feeds the commands and the server consumes them.

Commands are:

  • E - exit
  • T - sets timestamps for the upcoming file
  • C - file transfer
  • D - directory

See also Explanation for SCP protocol implementation in JSch library.



来源:https://stackoverflow.com/questions/37558853/how-is-scp-secure-copy-protocol-file-transfer-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!