Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the fastest method to get at a linux CLI in windows? (See this earlier question on StackOverflow.)

Basically my goal is to use a batch file in windows to control various things on my ubuntu mediacenter/server. Music being the main thing of course but it seems fairly invaluable, I can imagine a lot of people wanting this.

I am currently using ssh with plink, i can login send a command all in one line, perfect. Almost... there is a wait time of something like 5~6seconds between me hitting the command and it happening.

I assume that this is the authentication with ssh screwing me over since I have to login and authenticate before each command which is slow.

Possible ideas:

  • Somehow run the ssh CLIENT as a service on the windows box then when I want to send a command send it through the already open session. This seems doable. I'd prefer a tool to programming my own ssh app though to achieve this...
  • I did something wrong and logging in shouldn't take so long
  • plink is slow
  • batch files are slow (i can't imagine)
share|improve this question
up vote 2 down vote accepted

I'd install a ssh client on the windows box and compare the speed then with the speed you're getting using plink. You should be able to configure it to use a key file so that you don't have to login when you connect, once connected you'll only need to authenticate if you change user.

share|improve this answer
If i log into a regular ssh session like putty the commands go through fast, that's not the problem. Plink (the way I can send a command without me typing anything...) logs in, authenticates, sends the command, DCs with no intervention. I imagine using this even with a key auth I'd need to authenticate everytime I sent a command... I mean otherwise what security is there? No tunnel is being maintained since plink closes itself instantly. Or am I missing something. – Idiomatic Nov 19 '09 at 17:55
It depends then whether you want ssh to maintain a tunnel which you just use for all commands. Do your commands have to live in the batch file (do you have to be able to edit them easily) or could you get away with something sending udp or tcp packets over the network to trigger a bash file on the media server. Is your network public? – Amos Nov 19 '09 at 19:42
You could log in with ssh if you did need to edit the commands, and use a console text editor like emacs to edit the bash file. – Amos Nov 19 '09 at 19:43
"want ssh to maintain a tunnel which you just use for all commands." how? I can edit batch files over vpn or ssh or w/e that isn't a remote concern... "could you get away with something sending udp or tcp packets over the network to trigger a bash file on the media server." Yeah, a vpn is maintained with hamachi (can't setup ports other than 80 for webserver to be truly public because of dsl), anyways it counts as public from my pov. So is there an easy way to do this? Sounds like you are suggesting coding my own server which I don't really look forward to... modify another one maybe... – Idiomatic Nov 19 '09 at 21:12
The udp packet could be sent to a specific port for a specific option, or for security you could configure a reasonably random sequence of ports for the client and server to follow. The packet could contain specific code words read in sequence from a file on both machines no encryption necessary. Or you could go the tcp/ip route and seekl toestablish socket connections. – Amos Nov 19 '09 at 23:14

One alternative method you may consider is to turn your batch file on windows into a linux bash script as far as possible - this will reduce the number of 5-6second waits.



This way you only have to reauthenticate when you want to have user input, 5-6seconds seems a bit excessive for login though. If when you authenticate using putty it takes it a long time to ask for a password then try editing your /etc/ssh/ssh_config file and comment out:

GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
share|improve this answer

You must log in to answer this question.

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