Hmm, doing it THROUGH SSH would be prohibitively difficult. I think the easiest way would be to have a background program start running every time you have an ssh login to a specific account, which, after 10 minutes, kills all the ssh connections. Honestly it would be very easy.
You'd add something to ~/.profile or ~/.bashrc that says something like
sleep 600
killall --user {whateverhis/herusernameis}
end
Use ForceCommand in sshd_config. It is ensured it will be executed after login.
Is it possible to set a time limit on an active ssh connection for a specific linux user?
Match User ctfuser
ForceCommand "(sleep 600; killall -u ctfuser)& bash"
Or ForceCommand
to start a custom script
You can do so by adding the following parameter to your config file (/etc/ssh/sshd_config).
Run scripts automatically in server after ssh connection
one idea is that the timer restarts with every action from the user or that the user receives a console message every 10 minutes or the last 5 minutes that the session is about to be closed
How to prevent ssh user to login if same user is still logged in?
How to prevent multiple connections in SSH?
How can I disconnect ssh users, or limit the number of ssh logins?
ClientAlive*
are not for what you think. – Kamil Maciorowski Mar 20 '23 at 17:07