ControlPersist + IdleTimeout

Wout Mertens wmertens at cisco.com
Mon Jul 23 13:22:50 EST 2007


Hi there,

So I created a patch that makes ssh behave more like sudo. You  
connect to a host typing your password, you quit, you connect again  
and you are let in immediately. If you wait for too long you have to  
type your password again.

It works if you have a ControlPath, ControlMaster is auto,  
ControlPersist is yes and ControlTimeout is for example 5m. This will  
make a master when you quit your shell, and it will exit if no data  
has passed through for 5 minutes.

You can find it here:

    https://bugzilla.mindrot.org/show_bug.cgi?id=1330#c5


It works really well as long as you exit by closing your shell. If  
you exit by ~. or closing your terminal window, the daemonizing code  
doesn't run.

Can someone please explain to me how client_channel_closed() is  
called upon normal termination? I have a hard time gleaning it from  
the code.

I'm thinking to let the connection be daemonized when quit_pending is  
true in the client loop, but I'm also not sure if that catches all  
non-fatal exits that happen to ssh. Any comments?


Note that in the bug Damien proposes to fork the master first, before  
running the real session. However, that means that if creating a  
master connection fails, the whole ssh connection fails and it is no  
longer a drop-in script speedup.


I also just realized that I want the master connection to idle for 5  
minutes, but wait forever when a client is connected. That means  
setting the timeout to 0 when a client connects and resetting it to  
the control_timeout when the last client leaves. Right?


Thanks for any comments and pointers,

Wout.


More information about the openssh-unix-dev mailing list