serial-portputtyplink

Authenticating serial connection in Plink


I have a wifi module that I need to communicate with over serial connection. It requires a user/password to authenticate. Is this possible to achieve using Plink? here is what I am trying to do:

plink -v -serial COM7 -l yyyy -pw xxxx -sercfg 115000,8,1,n,N -m Display.txt

This is not working. The -pw is only allowed with SSH.

If I remove the -pw and run it I get this:

Opening serial device COM7
Configuring baud rate 115000
blah blah blah

The problem is, when I press enter, it then prompts for user which I specified in the command. Then it asks for the password. Then command in Display.txt never gets executed.


Solution

  • There's no authentication in serial connection.

    If you are getting prompted for username and password, these are prompts that are part of the session. They are not some specific authentication prompts that PuTTY can automatically answer with username and password specified in advance.

    Feed the responses to the prompts from a redirected standard input:

    (
        rem Simulate the initial Enter
        echo.
        echo username
        echo password
        echo command
    ) | plink -v -serial COM7 -sercfg 115000,8,1,n,N 
    

    You will also probably need to terminate the Plink somehow:
    Send commands via COM port using plink and exit