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.
Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
You may also be interested in other helpful articles:
- Lighttpd beware of default php session path permission
- Linux: Burn multi session CDs on Linux
- Howto improve ssh session performance by reusing an existing connection to a remote openssh server
- How to save your live CD session online
- Tutorial: Working with UNIX and Linux Shell
Discussion on This Article:
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: bidirectional_communication, cat_command, character_devices, communication_channel, kernel_configuration, linux_installation, login_sessions, master_slave, maximum_number, pseudo_terminal, ssh, sysctl_command, vi_command



i am using Red hat enterprise server & i dont see /etc/sysctl.conf file