LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Using 'say' to login SSH and execute command (https://www.linuxquestions.org/questions/linux-newbie-8/using-say-to-login-ssh-and-execute-command-797745/)

KavithaAshok 03-25-2010 04:08 AM

Using 'say' to login SSH and execute command
 
My problem is:

sub init() {

$Test->description("Establishing the connection to the client");

eval {
$Host = host($CLIENT) or die($@);
$Conn = connect("#ssh") or die "Client connection Failed" . $@;

};
if ($@) {
$Log->error("Unable to instantiate the Objects for the Test" .

$@);
return $TCD::CONFIG;
}

return $TCD::PASS;
}## end sub init ()

Here I’m trying to connect windows machine using connect object which

is working fine. But when I tried to execute the command on Windows

machine from Linux machine by using:

my (undef, undef,$output,undef) = say ($Conn, "cmd /c $CMD_PATH\\smvi

backup create -id $ID_NUM -backup-name $backup_name -server $SERVER",

-timeout,$TIMEOUT);


it is asking the username and password even if I don’t execute the

command which has option ‘-user-‘. Can just let me know why its failing

when I use ssh.

TB0ne 03-25-2010 08:06 PM

Quote:

Originally Posted by KavithaAshok (Post 3911485)
My problem is:

sub init() {
$Test->description("Establishing the connection to the client");
eval {
$Host = host($CLIENT) or die($@);
$Conn = connect("#ssh") or die "Client connection Failed" . $@;
};
if ($@) {
$Log->error("Unable to instantiate the Objects for the Test" .

$@);
return $TCD::CONFIG;
}
return $TCD::PASS;
}## end sub init ()

Here I’m trying to connect windows machine using connect object which

is working fine. But when I tried to execute the command on Windows machine from Linux machine by using:

my (undef, undef,$output,undef) = say ($Conn, "cmd /c $CMD_PATH\\smvi
backup create -id $ID_NUM -backup-name $backup_name -server $SERVER", -timeout,$TIMEOUT);

it is asking the username and password even if I don’t execute the command which has option ‘-user-‘. Can just let me know why its failing when I use ssh.

Please use CODE tags. And it's failing, because Windows doesn't work the same way as Linux does. Without seeing all the code, and knowing what version/distro of Linux, and how SSH is working on Windows, it's hard to say.


All times are GMT -5. The time now is 11:25 PM.