Capturing sftp logs on stderr

Bruce Guenter bruce at
Tue Aug 28 00:31:00 EST 2012

On Mon, Aug 27, 2012 at 10:45:34AM +1000, Damien Miller wrote:
> There isn't any way to do this in sshd/sftp-server. sftp-server is run
> within a session by sftp and usually has stderr attached to the session
> when it runs.

That's what I had discovered. Only "usually has stderr attached"? Are
there conditions it wouldn't?

> If you want to hack sshd, then you'd probably need to conditionally
> disable one of the dup2() calls in session.c:do_exec_no_pty() based on
> the contents of its command argument.

Thanks. Do I also need to change the calls to session_set_fds, or will
the err fd parameter be harmless if it's not actually in use?

Bruce Guenter <bruce at>      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <>

More information about the openssh-unix-dev mailing list