Update 2012-12-14 1807: Changed subject to better reflect the issue. Original Subject was
The system has no more ptys. Ask your system administrator to create more.
Marked as [SOLVED] since the functionality now works (with sudo).
I'm trying to use an "expect script to send a simple command to a remote box via ssh. The script looks like this:
#!/usr/local/bin/expect
# whack871 - log in to the cisco 871 and warm boot it entirely under script
# control.
#
# set Variables from arguments
set ipaddr [lrange $argv 0 0]
set user [lrange $argv 1 1]
set password [lrange $argv 2 2]
set command [lrange $argv 3 3]
#
set arg1 [lrange $argv 4 4]
set timeout -1
#
# connect to remote ssh server (ipaddr) with given command to execute
spawn ssh $user@$ipaddr $command $arg1
match_max 100000
#
# Look for password prompt
expect "*?assword:*"
#
# Send password aka $password
send -- "$password\r"
#
# send blank line (\r) to make sure we get back to gui
send -- "\r"
expect eof
and is invoked like this:
whack871 <IP ADDRESS> <USERNAME> <PASSWORD> <COMMAND>
with command in quotes if it contains spaces.
but it results in this:
spawn ssh tc@192.168.0.97 xtrlock
The system has no more ptys. Ask your system administrator to create more.
while executing
"spawn ssh $user@$ipaddr $command $arg1"
(file "/home/tc/bin/whack871" line 18)
Under Cygwin on Windows Server 2008 R2, I can use this to warmboot my router.
Under Core 4.7.1, I cannot use this to send a command to another Core 4.7.1 box. Booting the local box with the multivt boot code does not seem to help.
I have openssh.tcz, expect.tcz and tcl.tcz loaded and I can ssh to the remote box.
Does anyone know how to add more ptys ?