2

I have Windows 7 running on my PC, and am using Putty.exe to connect to Red-Hat server, somewhere along the network. Usually, I double-click the Putty.exe file, choose a session, and press 'open'. Then I entered my username and password, and was ready-to-go. I want to automate this process.

So, I've done some reading (even on similar questions asked over here), and tried the command-line approach. In the command line I typed in:

Putty.exe myusername@myserver -pw mypass

But got "putty Fatal error": 'unable to authenticate' error.

I'm guessing that I'm using the SSH protocol, trying to connect from the command line, but don't know which SSH (1 or 2), and don't think it matters. I've read about private-key/public-key method, but as for now - I want to stick with the username/password method.

Thanks to Celeritas' comment, I've tried to used auto-login method in Putty window - but got only 'Auto-login username' field, and not 'Auto-login password'. Also worth mentioning is the fact that I've got only the Putty.exe file, and without other helping tools, such as PuTTYgen.exe.

Thank you.

4
  • 2
    See here superuser.com/questions/999936/…
    – Celeritas
    Nov 25, 2015 at 6:36
  • Thanks, but no help from there. Updated my Q to explain.
    – Bak Itzik
    Nov 25, 2015 at 6:52
  • 3
    Are there special characters on your username or password? Command line might interpret them wrongly and send wrong symbols to the server. Nov 25, 2015 at 6:55
  • 2
    @MadocComadrin: Thank you! You solved it. I had '&' in the password. Once I encapsulated it with "" - it worked. (And now everybody knows one char in my pass :)
    – Bak Itzik
    Nov 25, 2015 at 7:05

3 Answers 3

0

I post my comment as answer too so the question can be marked as solved:

Are there special characters on your username or password? Command line might interpret them wrongly and send wrong symbols to the server.

1

I suggest to rather configure SSH keys authentication than login credentials remembering.

It's not that much complicated:

  • Generate a key with PuTTYgen.
  • Put you public key to RedHat server.
  • Add private key to PAGEANT.
  • Setup PuTTY.
1
  • Thanks, but it already solved by @Madoc Comadrin. Stupid 'special character' problem. And as I wrote - I don't have PAGEANT, nor the willing to setup private/public key right now.
    – Bak Itzik
    Nov 25, 2015 at 7:08
0

Auto-login to PUTTY SSH session using a .BAT file

Create a one-line batch file in any text editor:

@start putty -load "mySavedSession" -l yourusername -pw yourpassword


More info:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .