sshd and file descriptors

Frank Cusack fcusack at fcusack.com
Thu Jun 27 09:10:56 EST 2002


On Wed, Jun 26, 2002 at 07:06:13PM -0300, Andreas Hasenack wrote:
> 
> Shouldn't a daemon close all fds before going into "daemon land"?
> What exactly is broken here?
> 

rpm

A workaround which really isn't so great is to put this in your %post

exec 0</dev/null
for fd in `seq 1 12`; do
    exec ${fd}>/dev/null
done
service restart sshd

You might need to bump the end fd higher.  12 seems to work for rpm 4.0.x.
The w/a is kind of bad cuz now sshd will have all those fd's open.

/fc




More information about the openssh-unix-dev mailing list