Programs run over ssh aren't getting real ttys.

Bob Proulx bob at
Mon Nov 5 16:07:59 EST 2007

James Supancic wrote:
> I use OpenSSH on a number of machines. If I connect to most of my
> machines and open a bash shell the first three file descriptors of
> bash are something like /dev/pts/6. On these machines OpenSSH is as
> good as a "real" terminal.

On those machines ssh is allocated a pty device.  A pty is a pseudo
terminal emulating a classic serial port terminal.  So your statement
as good as a real terminal is pretty close to the truth if one
considers a serial port to be a real terminal.  Today however serial
port terminals are quite rare and most people consider pty devices to
be real terminals.

> However, I am putting together an embedded system and I must minimize
> the size of the installed system. I have OpenSSH working on this
> system but, when I connect and run bash the first three file
> descriptors are something like socket: [460].

In the case that you describe the input and output is being attached
to a socket device and not a pty device.  These are different types of
device drivers in the kernel.  pty devices support tty types of
operations while sockets support a more limited set of operations.

> The issue on this system is a number of tty related functions fail,
> greatly impairing my ability to use all but the simplest terminal
> programs.

Yes.  In that case 'ed' would be the editor of choice.  :-)

> What is wrong? What must I do to enable programs run over ssh (such as
> bash) to get real pseudo-ttys and not simple sockets?

This is really not an ssh question but a system question.  In order to
have tty/pty devices your system must support them.  If the system
does not support them then ssh can't create them magically.  If you
are working on an embedded system and this feature has been traded off
to save space then there is really nothing that can be done in ssh
about it.

What is in your /dev/pty* and /dev/tty* files and directories?  Is the
system providing support for pty devices?  When your sshd was build
for the system was it built with support for ttys?

Of course I have to make sure that you are running ssh in what would
be an interactive mode.  When running ssh with a command (e.g. ssh somecommand) then no pty is allocated.  You can
specifically request ssh to allocate a pty with the -t option.
That does not sound like your issue but it might be.  Ensure that you
are running ssh in a mode that would allocate a tty device.


More information about the openssh-unix-dev mailing list