≡ Menu

maximum number

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.

While administrating a box, you may wanted to find out what a processes is doing and find out how many file descriptors (fd) are being used. You will surprised to find out that process does open all sort of files:
=> Actual log file

=> /dev files

=> UNIX Sockets

=> Network sockets

=> Library files /lib /lib64

=> Executables and other programs etc

In this quick post, I will explain how to to count how many file descriptors are currently in use on your Linux server system.
[click to continue…]

You should always aware of maximum amount of memory and maximum number of CPU supported by Linux systems / server.

This is an essential task for making out decisions. You must consider at least AMD and Intel platforms, tested under RHEL 5 only:
[click to continue…]

Q. I would like to restrict number of CPU activated for some software licensing issues under Linux kernel 2.6.xx.. How can I limit the number of CPUs activated in SMP mode?

A. Pass a special parameter called maxcpus to kernel. It specify maximum number of processors that an SMP Linux kernel should make use of. For example if you have four cpus and would like to use 2 CPU then pass 2 as a number to maxcpus.
maxcpus=NUMBER

This is useful to test different software performances and configurations. Some commercial software such as ERP software or Oracle are licenced per CPU. In such a case maxcpus is a life saver.

Edit your grub.conf file:
# vi grub.conf
Append parameter maxcpus at the end of Kernel line. A the end it should read as follows:
kernel /boot/vmlinuz-2.6.13-Ora10g root=/dev/sda1 ro maxcpus=2
Save and close the file. Reboot system:
# reboot
Alternatively, you need to enter parameter at grub or lilo boot prompt. For example if you are using Grub as a boot loader, at Grub prompt press 'e' to edit command before booting.

  1. Select second line
  2. Again, press 'e' to edit selected command
  3. Select kernel line
  4. Append maxcpus=2 parameters.
  5. Press b to boot system

See also:

UPDATED for accuracy.

Linux How do I display failed login attempt?

/var/log/faillog is a log file for failed login attempts. This file maintains a count of login failures and the limits for each account. The file is fixed length record, indexed by numerical ID. Each record contains the count of login failures since the last successful login; the maximum number of failures before the account is disabled; the line the last login failure occurred on; and the date the last login failure occurred. Since data is in binary format you need to use faillog command to display failed login attempt.

How do I use faillog?

To display failed login attempt for user root with following command:
$ faillog -u root
Output:

Login       Failures Maximum Latest                   On
root            0        0   02/17/06 14:49:52 +0530  tty1

To display all failed login attempt try:
$ faillog -a
Output:

Login       Failures Maximum Latest                   On
root            0        0   02/17/06 14:49:52 +0530  tty1
rocky           0        0   02/27/06 22:05:03 +0530  tty1
usr1            2        0   02/16/06 15:05:01 +0530  tty2

See also: