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.
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 errors are followed by error message (terminated with new-line).
It's always a source side that feeds the commands. A 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