sshd's -e doesn't work as expected

Julio M. Merino Vidal jmmv84 at
Thu Dec 27 19:30:40 EST 2007

On 27/12/2007, at 0:41, Jim Knoble wrote:

> I think the intent was for '-e' to be used with '-D':
> __________[from sshd(8)]__________
> -D      When this option is specified, sshd will not detach and
>         does not become a daemon.  This allows easy monitoring of  
> sshd.
> __________[end sshd(8)]__________
> Perhaps sshd should complain if '-e' appears without '-D'?

Maybe, but I want it to run it in the background, so I would need to  
launch it with & instead.

Thinking about it, this may be good enough though.  At first, I  
thought that the pidfile was written before the call to daemon(3) so  
I thought it'd be safe to access that file immediately after the call  
to sshd (without -D nor -d) returned.  But after checking the code I  
see this is not the case (how could it be? you don't know the pid  
until you fork...), so it makes no difference for me to use -D or &  
because I can hit the race condition in any of the two ways.

So, OK.  If -e is always supposed to be used alongside with -D, then  
the daemon should complain about that situation.


Julio M. Merino Vidal <jmmv84 at>

More information about the openssh-unix-dev mailing list