Thursday, May 08, 2008

Putty passwordless ssh

putty accepts login and password as command line. So it can be easily used in batch to access machines without giving login and password.

putty host1 -l root -pw

I use it to the server which are build frequently. The problem with the server built frequently is that you cannot exchange keys as the keys will be deleted when the server is built again.

If you are using a linux box then sshpass can also be used for auto SSH.

Here is the batch script for windows lover

@echo off
if %1 == myserver goto myserver
goto default

:myserver
start C:\putty -ssh mercury -l -pw
exit

:default
start C:\putty -ssh %1 -l root -pw
exit

5 comments:

  1. Anonymous4:58 AM

    ssh tek hain ... telnet key liye kaise karna hain?????????!!!

    ReplyDelete
  2. did the default settings in the putty helps...
    I have it for ssh right now...

    ReplyDelete
  3. If you are using a linux box then sshpass can also be used for auto SSH.

    ReplyDelete
  4. Anonymous6:33 AM

    Thanks Jay. Help me a lot. One question: Can I add to this code batch file which will be executed as soon as I login to PuTTY? You can reply to me to kompasha@yahoo.com

    ReplyDelete
  5. Yes I use the command in a batch file. Here is what I do.

    I have created a batch file named s.bat in my windows path (C:\Windows or whatever on your system)

    Contents of batch file

    ----------------------------------------------
    start putty %1 -l root -pw NextGen
    ----------------------------------------------

    Let me know if you have any questions?

    ReplyDelete