Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

There is a webpage hosted at unix server serverX .The contents of the web-page are shown below.

user1@server1
user2@server2
user3@server3

Now user1@server1 user2@server2 user3@server3 are links.In case,If I want to log into unix account user1@server1 then, I can click on say user1@server1 ,then that should launch putty.exe with arguments user1@server1 from my local PC.So,this means that I will not need to launch putty.exe myself and then type in the server-name and user-name .This whole thing will be automated and will happen on just clicking on the link.Is this possible to implement ? How to go about it ?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

without some sort of client side web app (like ActiveX/Flash/Java) for instance, this is not possible (for good security reasons), and even with ActiveX/Flash/Java/etc. the security settings are usually set that launching applications is forbidden by the system.

This is also a typically bad way to do things on the security side because anyone with public access to your page could easily get the same access you would have.

If you just want to have to have an automated way to SSH into a server without having to manually type it all the time, you can create a simple batch file that logs into it for you then put that batch file's directory in your PATH variable.

example: C:\mycmds\myserver.cmd would contain the following:

@echo off
C:\path\to\putty.exe -ssh USER_NAME@IP_ADDR -pw USER_PASSWORD

Then put 'C:\mycmds' in your systems 'PATH' variable so that when you go to 'start->run' you can just type 'myserver' and it will auto log you into the server you want.

You could fancier in your batch file and put some command line argument processing so that you could specify which server you wanted from 'myserver'

Hope that helps

share|improve this answer
    
This is the right way to go. Now my next challenge would be to pass the arguments from the webpage to the batch script.Thanks for your help. –  g4ur4v Nov 24 '12 at 21:48
    
Your Note about BAT vs CMD is just plain incorrect. Batch files can also be executed without explicitly specifying .BAT, and indeed, by default take precedence over .CMD files in Windows (as per PATHEXT). As for the difference between them, it's just a matter of ErrorLevel being set or not, which hardly matters in most cases. For more you might want to read these two StackOverflow posts. –  Karan Nov 25 '12 at 0:13
    
@Karan - you are totally correct on the bat v cmd thing. That was a sleepless night mixed with a misconfigured system talking. I just removed the note because batch/cmd are beyond the scope of the answer/question regardless of correctness. Thanks for the heads up. –  txtechhelp Dec 4 '12 at 5:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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