KpyM Telnet/SSH Server - Forum
Runing Remote Commands with KpyM
Elessar Runing Remote Commands with KpyM
 
Does KpyM support the running of remote commands using SSH like ssh server do?

It currently doesn't seem to work but i wonder if the nag screen is currently causing the problem.

I want to have some scripts that run from a central linux server that runs commands on several client (windows) boxes


Kroum Grigorov
 
> Does KpyM support the running of remote commands using SSH like ssh server do?

KTS supports "terminal" sesions only, so you will be unable to run your scripts directly through SSH.

You might consider using some SSH scripting tool(for ex Paramiko) or switch to another SSH server.

You might find these usefull on scripting KTS
l0c41://www.kpym.com/phpbb/viewtopic.php?t=355
l0c41://www.kpym.com/phpbb/viewtopic.php?t=410

Kroum


Elessar
 
thank you, While i didn't use Paramiko (Python and i don't get along that well) it made me think to look for a perl equivalents.

(it was also necessary to remove the nag screen. (i didn't want to purchase it without knowing it worked but i lucked out))

I used the perl Net::SSH2 module.

NOTE this code i pieced from several different places online
code:

#!/usr/bin/perl
use Net::SSH2;

my $ssh2 = Net::SSH2->new();
$ssh2->connect('computer.address') or die;

#both public-key and password login work
if ($ssh2->auth_publickey('administrator','/root/.ssh/id_rsa.pub','/root/.ssh/id_rsa')){
#if ($ssh2->auth_password('administrator','admin's_pass')) {

my $chan2 = $ssh2->channel();
$chan2->shell();

#this shouldn't be needed but KpyM is a little slow
#so this is needed can be 3
sleep 5;

#kill IE this is just to show it working
#note /n isn't a newline in windows
print $chan2 "taskkill /F /IM iexplore.exe\r\n";
print "LINE2: $_" while <$chan2>;

#this is needed to have the terminal session end nicely
print $chan2 "exit\r\n";

$chan2->close;
} else {
warn "auth failed.\n";
}


 

© 2007 - 2008 Kroum Grigorov
Powered by phpBB © 2001, 2005 phpBB Group