Question

plink user@10.220.60.xx '/home/user/test/testpgm'

On running the below program which resides on a Linux machine from a windows machine using plink, I get only the following messages.

Test Pgm
Enter a string:

On Entering a string as input, It doesn't appear in the command window and the output as well doesn't appear.

#include<stdio.h>
int main(void)
{
   int i;
   char buf[30];
   printf("Test Pgm \n");
   printf("Enter a string:");
   fflush(stdout);
   gets(buf);
   printf("Input str:%s \n",buf);

   return 0;
}

gcc test.c -o testpgm

PS:Plink (PuTTY Link) is a command-line connection tool similar to UNIX ssh.

Était-ce utile?

La solution

Plinks documentation1 suggests, that you should not use Plink for interactive shell sessions, like you normally do with ssh, but for automated tasks instead. However, if you pass the -t parameter to your plink call, you can give it some interactive behaviour (with limitations).

some other alternatives to ssh in a windows environment are:

freeSSHd (provided by Microsoft) http://www.freesshd.com/

openSSH http://www.openssh.com/

dropbear https://matt.ucc.asn.au/dropbear/dropbear.html

I've tested none of these, but I think you'll figure it out :)

Autres conseils

It might not be useful for this scenario but to disable interactive prompts and to auto-accept the ssh handshake, you can use below mentioned options when trying to get into a server and executing commands using Plink.

plink -batch -v username@hostname -pw password -m shell.sh

Where: -batch (disable all prompts)

echo y | plink -ssh username@hostname -pw password -m commands.txt
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top