How to submit Plink “Access granted. Press Return to begin session” prompt automatically

北城以北 提交于 2019-12-06 07:30:12

问题


I'm writing a simple Windows batch script to allow me to execute some Linux command on my remote server with the help of plink.exe.

call set argument1=plink -pw mypwsswd username@172.19.48.111 cd ~/project; make clean; make -j8
call plink %%argument1%%

In a word, it will rebuild my C++ project on the remote server.

When I double click the batch, it works except that I have to type an Enter each time.

Access granted. Press Return to begin session

As you see, after I getting this windows, I have to type an Enter to continue.

Is there some way to avoid this? For example, typing an enter automatically?


回答1:


Since PuTTY 0.71 you get that prompt for security purposes, when you login in an interactive mode.
See PuTTY vulnerability vuln-auth-prompt-spoofing.

To use a batch mode, use -batch switch. That way you not only get rid of that prompt. It will also make sure the command does not hang on various other prompts that may occur, when something changes. Instead the command fails straight away.

If you want to keep the interactive mode, but avoid this specific prompt only, use -no-antispoof switch.



来源:https://stackoverflow.com/questions/57735695/how-to-submit-plink-access-granted-press-return-to-begin-session-prompt-autom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!