3
Currently I am trying to run bat files call_putty.bat
and call_plink.bat
, but it isn't excuting the input commands in -m E:\CREATE_ONT.txt
When I remove -m E:\CREATE_ONT.txt
, the SSH session is established successfully .
Here is the script inside 2 files *.bat.
putty.exe -ssh -2 -P 1022 admin@192.168.1.10 -pw admin -m E:\CREATE_ONT.txt
and
plink.exe -ssh -2 -P 1022 admin@192.168.1.10 -pw admin -m E:\CREATE_ONT.txt
In the CREAT_ONT.txt
file is the code run when I manually copy and paste it into SSH session.
How do I resolve this issue?
Any error message? What's the
plink.exe
output? What's in PuTTY Event log? – Martin Prikryl – 2015-07-19T12:17:23.567Hi. The
plink.exe
output is the putty window flash out and nothing happen. I can't see PuTTY Event log cause it disappear very fast. – Minh Nguyen – 2015-07-19T13:45:54.5701You have to run
plink.exe
from existing console window (typicallycmd.exe
). The PuTTY event log is in the PuTTY window title context menu. – Martin Prikryl – 2015-07-19T13:48:54.640Thank Martin. When i applied this code
plink.exe -ssh -2 -P 1022 admin@192.168.1.10 -pw admin -m E:\CREATE_ONT.txt
directly tocmd.exe
the error came outFATAL ERROR: Server refused to start a shell/command
. Any advise how do I resolve this issue? – Minh Nguyen – 2015-07-19T13:55:31.747Can you do this?
plink.exe -ssh -2 -P 1022 admin@192.168.1.10 -pw admin < E:\CREATE_ONT.txt
What the output will be? – Martin Prikryl – 2015-07-19T14:05:52.543@MartinPrikryl I do as you said and this is the ouput:
Started a shell/command; Sent EOF message; Disconnected: All channels closed
– Minh Nguyen – 2015-07-19T14:19:29.477OK and did it execute the command? Do you expect any output? – Martin Prikryl – 2015-07-19T14:28:49.437
@MartinPrikryl The command still won't execute. Nothing happen :( – Minh Nguyen – 2015-07-19T14:35:23.633
And if you type the same commands on
plink.exe
console? – Martin Prikryl – 2015-07-19T15:02:20.927When i remove
< E:\CREATE_ONT.txt
the result ofplink.exe
is the SSH connection is established and the window console is won't disappear. I copy commands from fileCREATE_ONT.txt
and it run normaly. – Minh Nguyen – 2015-07-19T15:12:06.157Did you check server log? (when using the
< E:\CREATE_ONT.txt
) – Martin Prikryl – 2015-07-19T15:22:00.070