Subject: pty limit and ssh
To: None <tech-net@netbsd.org>
From: Zafer Aydogan <zafer.aydogan@gmail.com>
List: tech-net
Date: 03/13/2006 15:32:59
hello list,

I noticed that you can login more users, than pty's are available.
Especially sshd accepts incoming connections without checking the left
amount of pty's it can allocate.
By default you have 64 pty's [tty[p-s]*] . And if 64 users are logged
in, sshd should refuse incoming connections. Currently this happens,
when the 65th User tries to login:

Server refused to allocate pty
To invent, you need a good imagination and a pile of junk.
                -- Thomas Edison

and freezes here. As you can see you are logged in and in my case you
see the fortune message. You can log out using CTRL+D but you cannot
type anything.

Syslog shows:
sshd[715]: error: openpty: No such file or directory
sshd[846]: error: session_pty_req: session 0 alloc failed

In contrast, telnetd behaves correctly, by printing "telnetd: All
network ports are in use." and terminating the connection.

I would suggest sshd to behave the same.
I know how to increase the number of pty's or to use ptyfs. This is
about why there are no checks before the login attempt is passed to
sshd.


Greets, Zafer.

ps: system is 3.99.15