3

I have a situation where I need to have PuTTY (or another SSH client for Windows) automatically log into another machine via SSH. I realize that this isn't a good idea security-wise, but unfortunately I'm constrained by the limitations both on the client and the server.

The best solution would be to have a shortcut or script on the desktop that, when double clicked, will connect to the server and automatically log in. Can I do this with PuTTY?

I am willing to explore public key authentication, but I'm not sure where the PuTTY key resides or how to copy it to the server, as the app starts automatically upon login.

3 Answers 3

2

You will do:

putty user@host -pw password

Notice that using public-key authentication is safer and preferred.

3
  • I can't seem to get it to work - I get back unknown option "pw:<password>" May 11, 2009 at 20:48
  • Corrected syntax. The password option is -pw and not -pw:
    – user1797
    May 11, 2009 at 20:54
  • Excellent, that works! May 11, 2009 at 20:57
11

You should use SSH keys instead. You can have those passwordless too. Its not a good idea either, but it's a lot better than saving passwords in scripts.

You generate a key with putty-gen, and save it where ever you like. Then you create a profile in putty.exe and attach that key to it.

When you want to start with that profile:

putty.exe -load <profilename>
5
  • You have the general idea, but your instructions are incorrect. You might want to consider revising it to fully explain public-key authentication creation and use with putty, or link to a site that has all the details, like I did.
    – user1797
    May 11, 2009 at 20:58
  • I've gone with a hybrid of both your answers - loading a profile with the window settings and using -pw to specify a password. Unfortunately, I can only award one accepted answer, but I still voted yours up. May 11, 2009 at 21:10
  • @David: You're probably right. On the other hand, I pointed him in the correct direction. You just pointed the mans gun on his foot :( I don't think that "wrong" questions need to be answered to the letter. May 11, 2009 at 21:11
  • @Keen, I answered to what he asked. It is not the preferred way (and I said so), but putty's author thought of it to be handy enough, so he coded it in putty.
    – user1797
    May 11, 2009 at 21:21
  • I think it's a bit harsh to characterize hard-coding passwords into script/shortcuts as pointing a gun at my foot - there are definitely legitimate reasons for doing this, and my situation counts as one. May 11, 2009 at 21:35
-4

abandon putty if you need to store passwords such as remote ssh access to management consoles where you can't drop keys into the firmware image etc. i can think of 4 scenarios where you can't use keys and putty gets in your way and slows you down.

You must log in to answer this question.

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