Send command through PuTTY automatic login

Posted by Arthur on Super User See other posts from Super User or by Arthur
Published on 2014-06-11T08:44:35Z Indexed on 2014/06/11 9:29 UTC
Read the original article Hit count: 213

Filed under:
|
|
|
|

I am using the following to login automatically to a remote server and then run commands listed in a commands.txt, like this:

C:\path to\putty.exe -ssh adreese.ip -l user -pw Password -m C:\Path to\command.txt

commands.txt contains the following:

wakeonlan -i broadcast adress Macadress

However, when I try to do so a new window for PuTTY appears, but it closes and exits instantly after login. As a result, I cannot see the output of the command(s).

After a several tests, it appears that the command is not execute , cause my computer doesn't "wake on lan". I don't understand what's going on here ?

I cannot use the plink.exe program cause I cannot make connection with public key ( too much distant site for doing all the registration keys in putty )

Can someone help me with this ? Or can i use another program to make ssh connection and send command with script from a windows os?

Edit : I also try to make a bash file in the distant server with the same command and execute it from the session like this :

C:\path to\putty.exe -ssh adreese.ip -l user -pw Password \home\user\script.sh

Ihave the same problem... Need help please : /

© Super User or respective owner

Related posts about linux

Related posts about Windows