Open tigerinus opened 6 months ago
The SCP protocol is deprecated and recent versions of scp also use SFTP.
It is totally possible and would be great ! I would first like to do a small review of the technologies we could use for it though. SFTP is cool, but maybe something like WebDAV is a good candidate as well. Let me know if you have other ideas. In the meantime we could imagine coming up with a temporary solution that would only need to be implemented by the client. By doing so, we don't have to update the whole SSH3 protocol right now for "scp3" and only update it when we come up with a solid design.
Meanwhile you might be able to use rsync. Here is an example which uses rsync with netcat: https://superuser.com/questions/1330291/use-rsync-with-nc-as-transport-layer#1517462
It might be possible to modify the example to use SSH3 with cat over the terminal instead of netcat.
Based on @siepkes's example, I pushed on branch rsync_compat a slight CLI modification to be compatible with rsync and how it calls its underlying remote shell:
1) rsync calls the remote shell protocol with the -l <username>
CLI arg to set the username, so I added that arg to ssh3
2) rsync does not like us specifying the request path in the remote host url like we classically do in ssh3
. I therefore added the -url-path <secret-path>
CLI arg on the client specifying the url path to query on the remote host.
Here is an example that works with rsync and ssh3
:
rsync -a --info=progress2 --rsh 'ssh3 -privkey ~/.ssh3/id_rsa -url-path /ssh3-inl' user@host:~/remote-dir/ ./rsync_output/
This will copy recursively the directory ~/remote-dir
on the remote host and place its content in the ./rsync_output
local directory.
It works well, but rsync ends with a broken pipe, I don't know why, maybe SSH3 closes the connection too early. We should investigate but right now the files are copied correctly and it seems to work with several files as well.
Let me know your thoughts !
It works well, but rsync ends with a broken pipe
In my case old rsync version failed with rsync error: sibling process terminated abnormally (code 16)
which was caused by ssh3 receiving SIGPIPE. I could not track down why it gets it but its possible to workaround by adding signal.Ignore(syscall.SIGPIPE)
to the main.
rsync does not like us specifying the request path ... therefore added the -url-path
It also does not support port (see https://stackoverflow.com/questions/4549945/is-it-possible-to-specify-a-different-ssh-port-when-using-rsync) so I've added -url-port
flag, see https://github.com/AlexanderYastrebov/ssh3/tree/rsync_compat2
The shell session works well. The missing piece is file transfer.
Any plan?