This is a multi-part message in MIME format.
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Eric Millbrandt wrote:
> I am out of ideas about what the problem is. I am using the default
> sshd_config installed by the port. I can authenticate, copy files, and
> start processes, but sshd fails to create a tty session. This happens
> from remote machines and creating a session from the host machine. I
> find the following under messages.
> Aug 8 19:32:16 mongoloid sshd[44626]: fatal: mm_send_fd: sendmsg(4):
> Bad file descriptor
> Aug 8 19:32:16 mongoloid sshd[44626]: error: close(s->ptymaster/0): Bad
> file descriptor

This appears to be a problem with the descriptors returned by openpty()
or (less likely) a problem with descriptor passing. (2.0 vintage
Linuxes had at least one problem with descriptor passing but I see
that's not what you have).

> # uname -a
> FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #9: Thu

In order to figure out what's going on, we need to know what options are
enabled on your config.h that affect pty allocation.

From our survey data I see that FreeBSD 4 has openpty (which is used if
possible) so HAVE_OPENPTY should be set. (Could you please check
config.h and confirm, if not post your config.h here.)

Also, you could try this patch to see what descriptors openpty returns.
I suspect that one or both descriptors will be -1 but openpty will
have returned 0 (ie success).

Darren Tucker (dtucker at
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;

Index: sshpty.c
================================================== =================
RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/sshpty.c,v
retrieving revision 1.43
diff -u -p -r1.43 sshpty.c
--- sshpty.c 5 Aug 2006 02:39:41 -0000 1.43
+++ sshpty.c 16 Aug 2006 11:07:26 -0000
@@ -69,6 +69,8 @@ pty_allocate(int *ptyfd, int *ttyfd, cha
if (!name)
fatal("openpty returns device for which ttyname fails.");

+ error("openpty returned %d descriptors %d/%d name %s", i, *ptyfd,
+ *ttyfd, name);
strlcpy(namebuf, name, namebuflen); /* possible truncation */
return 1;

Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

openssh-unix-dev mailing list