Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

this question is not the same as others, who asked for that they cannot connect to server, the issue i have is that i cannot start more new ssh connections...

now i am connected to remote server using ssh, but when i try to start a new ssh connection, the server just refused to allocate pty, why this happens? is there any limitation that limits the number of ssh connection to server?

you can see what happened when i try to open new ssh connections with the following link: http://i1271.photobucket.com/albums/jj624/bigmeowOoO/refuse_to_connect_allocate_pty.jpg

by the way, i don't think there is something wrong with the pty files, since i can connect to server:)

also, i want to know what these files stands for?

ls /dev/pts
0  11  13  15  17  19  20  22  24  26  28  3   31  4  6  8
1  12  14  16  18  2   21  23  25  27  29  30  32  5  7  9

file /dev/pts/0 /dev/pts/0: character special (136/0)

character special, what is its function?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

First off since you can connect via ssh, you can choose to not create a new PTY with ssh using the -T parameter (this parameter disables creating a PseudoTerminal). If you use PuTTY, under SSH tree check the "Don't allocate pseudo terminal".

There is possibly a limit of PTY's set by the host.

If you are on an OpenVZ server you can check if the admin has set PTY restrictions by accessing the beancounter file.

cat /proc/user_beancounters

Look for numpty row. There will be columns for # held, limit (which is what you might be looking for). If you're limit is below 5, its unreasonable because you won't be able to run many scripts especially if you use screen. You can request for an increase.

each of the files listed under /dev/pts are pseudo terminals. They are "fake" terminal sessions.

Read here for a brief overview: http://en.wikipedia.org/wiki/Pseudo_terminal and http://www.gnu.org/software/libc/manual/html_node/Pseudo_002dTerminals.html

share|improve this answer
    
if allocate pseudo terminal is set, seems i can do nothing with that ssh connection:( –  giantforest Aug 15 '12 at 7:29
    
the limit of numpty is 32:( why the openvz service provide set such a limit on the number of ptys? –  giantforest Aug 15 '12 at 7:36
    
how to bypass such kind of limit? i just to open more bash sessions:) –  giantforest Aug 15 '12 at 7:42
    
Because they want to limit the number of things running on their server. If you need more than 32 sessions running that might indicate abuse from an admin's point of view. I think 32 is a very fair number. And if its only ssh sessions I've told you how to open as many as you want under Putty. –  Jay Aug 15 '12 at 14:36
    
yes, if i set Don't allocate pseudo terminal on putty, the connection will not occupy pts resource, but what a ssh connection with pts can do? –  giantforest Aug 16 '12 at 6:30
add comment

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.

service such as ssh, screen, expect, telnet etc use pty (pseudo-terminals)

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

cat /proc/sys/kernel/pty/max

4096

share|improve this answer
    
yes, the content in /proc/sys/kernel/pty/max is 4096, what it means, seems i cannot modify this file:( –  giantforest Aug 15 '12 at 7:22
    
Yes, we can modify the number by Open kernel configuration file - /etc/sysctl.conf Add the following line. kernel.pty.max = 5120 and save the file reload the changes by using sysctl -p verify the changes cat /proc/sys/kernel/pty/max the maximum value that can be set is 5120 –  ZVIK Aug 15 '12 at 8:30
    
ibm.com/developerworks/linux/library/l-proc/index.html read this will give some information related to proc filesystem –  ZVIK Aug 15 '12 at 8:49
    
just failed to modify that value:( [root@home ~]# sysctl kernel.pty.max=8192 error: "Operation not permitted" setting key "kernel.pty.max" –  giantforest Aug 15 '12 at 10:31
    
If you are on a VPS we cannot change kernel parameters, as the hosting providers prevents it from modifying it. To do so you need to have a dedicated server. but i am not sure doing the above fix might fix your problem –  ZVIK Aug 15 '12 at 10:46
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.