Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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 [email protected] 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

enter image description here

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?

like image 217
Yves Avatar asked Aug 31 '19 06:08

Yves


People also ask

What can I use instead of Plink?

I'd recommend you stick with PuTTY too. You might find it useful to run Pageant in conjunction with Plink to avoid having to type in the passphrase.

What is plink command?

Plink (PuTTY Link) is a command-line connection tool similar to UNIX ssh . It is mostly used for automated operations, such as making CVS access a repository on a remote server.

Does plink use SSH?

More typically Plink is used with the SSH protocol, to enable you to talk directly to a program running on the server.


1 Answers

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.

like image 148
Martin Prikryl Avatar answered Oct 23 '22 11:10

Martin Prikryl