Increase the maximum number of pseudo – terminals ~ PTY on Linux for remote Login session

43 views
Skip to first unread message

Dhaval Soni

unread,
Jul 5, 2009, 7:39:47 AM7/5/09
to vglug
Dear All,

Increase the maximum number of pseudo – terminals ~ PTY on Linux for remote Login session

Generally service such as ssh, screen, expect, telnet etc use pty (pseudo-terminals) in master – slave mode for login and other purposes. If pty setting is too low many users will not able to login to system using ssh or other commands. In this tip I will explain how to increase the maximum number of pseudo-terminals.

pty man page defines pseudo-terminal as follows:

A pseudo-terminal is a pair of virtual character devices that provide a bidirectional communication channel. One end of the channel is called the master; the other end is called the slave. The slave end of the pseudo-terminal provides an interface that behaves exactly like a classical terminal. A process that expects to be connected to a terminal, can open the slave end of a pseudo-terminal and then be driven by a program that has opened the master end. Anything that is written on the master end is provided to the process on the slave end as though it was input typed on a terminal.

List the maximum number of Pseudo-terminals

Just run the following command to list / display the maximum number of Pseudo-terminals under Linux

$ cat /proc/sys/kernel/pty/max

Output:

1024

Increase the maximum number of Pseudo-terminals (PTY)

If you have large Linux installation such as University or ISP login service you need to increase the PTYs to allow more login sessions. Open kernel configuration file - /etc/sysctl.conf:

# vi /etc/sysctl.conf

Append following config directive (support 5120 ptys)

kernel.pty.max = 5120

Save and close the file. Reload the changes:

# sysctl -p

Verify that the new maximum number of pseudo-terminals value is changed, enter:

$ cat /proc/sys/kernel/pty/max

Further readings

=> Refer to sysctl, proc, and pty man pages for more information.


--
Kind regards,
Dhaval Soni

Cell: +91-9662029620
***************************
According to Mahatma Gandhi: "First they ignore you, then they laugh at you, then they fight you, then you win."* So by that reckoning, it must be pretty much 'job done' for free software...!
Reply all
Reply to author
Forward
0 new messages