Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hi Friends, Wanted to know if tcl scripts can handle pop ups when doing ssh?

70 views
Skip to first unread message

Saurabh

unread,
Jun 20, 2012, 3:12:55 AM6/20/12
to
Doing ssh to a server for the first time.
spawn ssh user@ip
expect {
"yes/no)?" {
send "yes\r"}
"password:" {
send "password\r"}
}
if doing ssh for the second time and ssh key has changed then we can write a script to delete the line in known_host which contains the key and then ssh.

My first question is do we get any popup if trying to run the script on linux box? If yes how can a tcl script handle that?

When running the same script on windows we get a popup. How can we handle that popup from the script itself?


gho...@gmail.com

unread,
Jun 20, 2012, 5:17:43 PM6/20/12
to
On Wednesday, June 20, 2012 1:12:55 AM UTC-6, Saurabh wrote:
> My first question is do we get any popup if trying to run the script on linux box? If yes how can a tcl script handle that?

This will depend on what is actually running when you call shh; if you're running openssh, then you can add -oStrictHostKeyChecking=no to the command call or add it to your ssh_config file. This will automatically accept add new keys to the known_host file.
http://www.openbsd.org/cgi-bin/man.cgi?query=ssh_config&sektion=5


> When running the same script on windows we get a popup. How can we handle that popup from the script itself?

Again, this will depend on ssh, but the easiest way would be to mimic the above with the equivalent settings for the windows ssh client.
You could also look in to using twapi to deal with the popup if there's no way to disable it. I haven't used twapi to do this myself...
http://twapi.magicsplat.com

You probably already know this, but for the benefit of anyone who may not... It's generally a bad idea to blindly accept a hosts key, unless the remote server is under your control.

Saurabh

unread,
Jun 23, 2012, 1:23:30 PM6/23/12
to
Thanks for reply

Sandeep Nanda

unread,
Jun 29, 2012, 11:52:47 PM6/29/12
to
If you are running this on a linux server, there is high possibility that you will not get a popup window (since you will be using a CLI client). Though you might get a prompt on the CLI itself.
I think that would be easy to handle using Expect.

In case you get a popup window (on windows or linux), you simply cannot use Expect to handle it. So you would need some gui automation tool to handle it. On windows, you can code it yourself using TWAPI. Not sure about linux
0 new messages