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.

Kyle Cronin
  • 1,238
  • 14
  • 26

3 Answers3

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>
Commander Keen
  • 1,253
  • 7
  • 11
  • 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. –  May 11 '09 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. – Kyle Cronin May 11 '09 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. – Commander Keen May 11 '09 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. –  May 11 '09 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. – Kyle Cronin May 11 '09 at 21:35
2

You will do:

putty user@host -pw password

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

-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.

ugh
  • 1