How to configure
sftp-server subsystem specified in
/etc/ssh/sshd_config to disconnect idle SFTP clients.
But this has been declared as a bug in 8.2 and is no longer working. Since 8.2, there's no way to disconnect the idle clients, only unresponsive clients.
I believe these days, most OpenSSH installations are still pre-8.2, so you might still be able to use this. But it may stop working after upgrade one day.
As @KamilMaciorowski suggested in a comment, a clever wrapper (script) over the
sftp-server executable would do too. It won't even be difficult. It would ignore SSH keepalives though (what some may like, some not). And it will need the
sftp-server binary (instead of the default
internal-sftp), what makes it complicated to chroot the session