0

I created a script to connect automatically to my Raspberry using putty :

start /D "C:\Program Files\PuTTY\" putty.exe -ssh 192.168.1.104 -l pi -pw mypassword

But it doesn't load properly, it does use the pi username but I get an access denied for the password it then asks me for another password as you can see :

Using username "pi".
Access denied
pi@192.168.1.104's password:

When I type the exact same password it let me access the Raspberry.

Do you know what I did wrong ? Thanks in advance !

1

This works fine on my machine. Are you using any special characters in you password?

Try using quotation marks at your password in the script.

start /D "C:\Program Files\PuTTY\" putty.exe -ssh 192.168.1.104 -l pi -pw "mypassword"

Some characters in Windows command line have specific meaning i.e. @, $, !, %, =, \, so you could easily output another string as password argument, or form an escape sequence.

For example, %0-%9 would output arguments no. 0 - no. 9 passed to the batch script file, %cd% would print current path.

Here is a table of escape sequences used in Windows batch script files.

+-------------------------+-----------------+ | Character to be escaped | Escape Sequence | +-------------------------+-----------------+ | % | %% | | ^ | ^^ | | & | ^& | | < | ^< | | > | ^> | | | | ^| | | ' | ^' | | ` | ^` | | , | ^, | | ; | ^; | | = | ^= | | ( | ^( | | ) | ^) | | ! | ^^! | | " | "" | | \ | \\ | | [ | \[ | | ] | \] | | " | \" | | . | \. | | * | \* | | ? | \? | +-------------------------+-----------------+

Hope this helps.

  • Ok yes thank you ! I have a "&" in my password. I added the " and now it works fine ! :) – JackA May 16 '17 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.