sshd and file descriptors

Andreas Hasenack andreas at conectiva.com.br
Thu Jun 27 11:18:23 EST 2002


Em Wed, Jun 26, 2002 at 04:10:56PM -0700, Frank Cusack escreveu:
> 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.

I started doing this, but closing the fds instead of opening them to /dev/null.
Just use:

                        for n in `seq 3 100`; do
                                eval "exec $n<&-"
                        done

This will close those fds. Not very ellegant, but it's what I was doing
for now.



More information about the openssh-unix-dev mailing list