[CentOS] Force close on unattended SSH/SFTP connections

Fri Nov 21 01:19:21 UTC 2008
Filipe Brandenburger <filbranden at gmail.com>

Hi,

On Thu, Nov 20, 2008 at 19:14, Yanagisawa, Koji <yanagik317 at netscape.net> wrote:
> I need unattended OpenSSH and its SFTP connections to be closed after a
> while (say, in 10 minutes).

I believe you can do that with iptables, using the ipt_recent module.
I did not test it or did it before, but looking at the man page it
looks like a tool that could be used to implement just that.

See "man iptables" and look for "recent". The examples usually do the
opposite (block someone for a certain amount of time), but you should
be able to come up with the rules to do what you want on your own.

See also http://snowman.net/projects/ipt_recent/

HTH,
Filipe