Where do I find the spec for scp -t?

冷暖自知 提交于 2020-11-29 08:43:48

问题


So I have discovered I can do the following with scp via stdin:

Directory creation

scp -tr .
stdin -> D0755 0 <directory_name>
stdin -> \x00

File writing

scp -tr .
stdin -> C<filemode, eg. 0744> <file_size_in_bytes> <filename>
stdin -> actual file bytes
stdin -> \x00

In the man pages I can't find any mention of this, nor have I had luck with googling. Where do I find the spec for these various commands: file creation, directory creation? What else can I do? I'm curious where this is defined. I'm struggling to find where I even found this code initially. Why is there no mention of the -t flag in the scp man page?


回答1:


scp transfers files by opening an SSH connection to a remote server and invoking another copy of scp on the remote system. The two scp instances communicate through a simple protocol; one instance sends commands and file data; the other instance acts on the commands to store the files on its local system.

The -t option tells scp that it was invoked by another scp instance and that it'll be receiving files. There is another option -f which tells scp that it was invoked by another instance and should send files.

You'd have to ask the OpenSSH developers why the options aren't documented. One might presume that it's because they're not intended for use by humans and so not really part of the user interface.

The best online descriptions of the SCP protocol that I know of are:

  • How the SCP protocol works
  • Ruby net-scp source code
  • OpenSSH scp source code


来源:https://stackoverflow.com/questions/50637523/where-do-i-find-the-spec-for-scp-t

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