Pravin Agre
Pravin Agre

Reputation: 371

pty.fork() error python pexpect

I am using pexpect with cgi to ssh into remote machine, Whenever i run a script which does ssh using pexpect from the linux terminal it gives me the correct result, but when i call the script using commands module from the cgi program i am getting the following error.

(0, '(256, \'Traceback (most recent call last):\n File "/usr/local/https/pro.py", line 85, in \n main()\n File "/usr/local/https/pro.py", line 66, in main\n mac = RemoteCommand(command,passwd)\n File "/usr/local/https/pro.py", line 42, in RemoteCommand\n child = pexpect.spawn(command)\n File "/usr/lib/python2.5/site-packages/pexpect.py", line 375, in init\n self.__spawn()\n File "/usr/lib/python2.5/site-packages/pexpect..py", line 446, in __spawn\n raise ExceptionPexpect(\\'Error! pty.fork() failed: \\' + str(e))\npexpect.ExceptionPexpect: Error! pty.fork() failed: out of pty devices\')')

Upvotes: 1

Views: 948

Answers (1)

chris
chris

Reputation: 1

ExceptionPexpect(\'Error! pty.fork() failed: \' + str(e))\npexpect.ExceptionPexpect: Error! pty.fork() failed: out of pty devices\')')

your system has reached the max # of pty devs. your should increase those according to your needs. keep in mind, for resource & security reasons it shall be useful to limit access to pty to the specific script user.

Upvotes: 0

Related Questions