Hi,
I am trying to connect to a remote Windows Server 2003 machine via SSH from my local machine.
The remote machine runs an OpenSSH server. I tried to connect with an OpenSSH client in Cygwin. From the (Cygwin) bash, I typed:
$ ssh remote_machine -l Administrator
Then, the bash would output:
"Administrator@remote_machine's password: "
This complete procedure worked fine. However, when I ran my Expect script, issh.tcl, to do the same thing, I got frustating *unexpected* behaviors.
--- Expect script (start) ---
#!/bin/sh
# \
exec tclsh "$0" ${1+"$@"}
package require Expect
spawn ssh remote_machine -l Administrator
expect "password: "
send "my_password\r"
expect "Administrator>"
--- Expect script (end) ---
When I ran the script with -d option:
--- start ---
expect version 5.26
argv[0] = expect argv[1] = -d argv[2] = issh.tcl
set argc 0
set argv0 "issh.tcl"
set argv ""
executing commands from command file issh.tcl
spawn ssh remote_machine -l Administrator
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {3420}
expect: does "" (spawn_id 4) match glob pattern "password: "? no
Administrator@remote_machine's password:
--- end ---
The strange thing is on the line: expect: does "" (spawn_id 4) match glob pattern "password: "? no.
Why did I get ""? What character is that? If I connected directly (without using Expect), I never received the "".
Any help is greatly appreciated.
Memomana
I am trying to connect to a remote Windows Server 2003 machine via SSH from my local machine.
The remote machine runs an OpenSSH server. I tried to connect with an OpenSSH client in Cygwin. From the (Cygwin) bash, I typed:
$ ssh remote_machine -l Administrator
Then, the bash would output:
"Administrator@remote_machine's password: "
This complete procedure worked fine. However, when I ran my Expect script, issh.tcl, to do the same thing, I got frustating *unexpected* behaviors.
--- Expect script (start) ---
#!/bin/sh
# \
exec tclsh "$0" ${1+"$@"}
package require Expect
spawn ssh remote_machine -l Administrator
expect "password: "
send "my_password\r"
expect "Administrator>"
--- Expect script (end) ---
When I ran the script with -d option:
--- start ---
expect version 5.26
argv[0] = expect argv[1] = -d argv[2] = issh.tcl
set argc 0
set argv0 "issh.tcl"
set argv ""
executing commands from command file issh.tcl
spawn ssh remote_machine -l Administrator
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {3420}
expect: does "" (spawn_id 4) match glob pattern "password: "? no
Administrator@remote_machine's password:
--- end ---
The strange thing is on the line: expect: does "" (spawn_id 4) match glob pattern "password: "? no.
Why did I get ""? What character is that? If I connected directly (without using Expect), I never received the "".
Any help is greatly appreciated.
Memomana