SFTP ServerAliveInterval

Hey,

is it possible to setup heartbeats for sftp connections?

Thanks,
Andrey

Hmm, I'm not sure there is direct library support for this in

https://github.com/pkg/sftp or x/net/ssh

How are these usually configured? How do you notice the lack of them?

Maybe rclone could just send a null SFTP command every 5 minutes or something like that?

thanks for response!

we can configure those via sshd_config

the problem and root cause after initial research is that plain sftp client on mac/linux works w/o any problems with pre-configured keep-alive packets, but unfortunately, rclone doesn't, and we can't find any options to turn this keep-alive on.

much appreciate for any help!

unfortunately i can't include links to my replies, but you can find that option in man(dot)openbsd(dot)org/ssh_config#ServerAliveInterval

What should happen is that rclone opens a new connection and retries if the connection was found to be stale.

Is that not happening?

I've bumped you up a trust level so you should be able to post URLs now.

https://man.openbsd.org/ssh_config#ServerAliveInterval

ServerAliveInterval
Sets a timeout interval in seconds after which if no data has been received from the server, ssh(1) will send a message through the encrypted channel to request a response from the server. The default is 0, indicating that these messages will not be sent to the server.

I found an example of how to send ssh keepalive messages here

Though as I noted before this could be done at the sftp layer by sending, for example sftp.Client.GetWd()

Yes, reconnection happends, and retries works for rclone, but wehave to transfer files in this case during one connection, that’s why we are interesting to have keep alive packets to be supported.

OK sounds interesting! Can you please make a new issue on github about this? Put a link to this forum page in it. Thanks!

thanks man! filled up one for you: https://github.com/rclone/rclone/issues/4353

1 Like

any updates so far?

Best to follow the issue and post there than post in both spots.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.