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

I have a nice 8-core Windows 7 machine where I deployed several virtual machines in VMWare Workstation. I want to be able to launch the virtual machine remotely, by executing something like "vmrun -T ws H:\VMWare\VM1\VM1.vmx nogui". I can assume, that there is always a user logged in in the host, and it is always the same one.

The command runs fine locally, but the problem is when I try to run it remotely.

Doing that with cygwin's ssh is impossible, because somehow the vmrun needs access to the local screen, which to my knowledge is impossible in cygwin's ssh, as it is running as Windows service. I know, that I might write a pair of applications to circumvent the problem, one launched at user's logging in, and the other invoked by remote user which sends commands to the first one by IPC. I have a strong feeling, that someone already have written such application so I don't need to waste time reinventing the wheel.

I don't think that other ways of communication which rely on windows credentials are secure enough, so I prefer not to use tools like psexec which can be easily sniffed and decrypted with rainbow tables (I don't have radius server). Or maybe I am wrong and they are indeed secure?

share|improve this question

I do exactly this all the time by using Cygwin ssh to port-forward to 3389. Then you can RDP into your workstation (which is over the ssh tunnel, so that should allay your concerns about windows credentials), start up VM workstation and play and VMs you want, and get out.

share|improve this answer
Yes, it is the solution I currently use, but I'd rather avoid it, because one cannot script it. I have 8 VMs, and it would be really cool to be able to launch them in sequence programmatically. – Adam Ryczkowski Apr 18 '12 at 12:00

You can execute command remotely pretty easily using PsExec. Of course, it relies on Windows authentication mechanisms to work.

share|improve this answer
up vote 0 down vote accepted

Finally I found the solution that suits me the best:

The point is to not to run sshd as a Windows service, but from user's personal startup (possibly as a hidden window). That's all. The only trick here is that I need to run it as elevated process.

To launch cygwin sshd interactively in Windows 7 one needs to follow these steps. (I assume, that cygwin is installed to C:\cygwin, and that it contains the openssh package):

  1. Set the sshd service in Administrative Tools\services applet to "Manual launch" or "Disabled"
  2. Take ownership of C:\cygwin\var\empty folder
  3. (optional - for debug) Make sure, that when you run /usr/bin/sshd -D under elevated cygwin prompt you get ssh access to your host.
  4. (optional - for debug) Make sure that when you launch C:\cygwin\bin\run -p C:\cygwin\bin /usr/sbin/sshd -D from elevated command prompt you still get the same access as in point 3. Remember to kill the sshd.exe process afterwards using task manager.
  5. Create new task which launches this command under elevated credentials just after you log-in. See this forum thread to see how to do this
  6. Log-in with ssh from remote host and run the vmrun -T ws start ... command as you would do it locally, and everything works as expected.

I hope it helps those of you, who prefer to stick with ssh authorization for performing administrative tasks.

Please note, that for it to work the user need to actually log into the host (I believe it is best to do it interactively (i.e. not through rdp), but I have not tested this theory) so this solution is best suited for home/small office network, and perhaps it is not suited for a dedicated server, unless you configure it with "autologon" (but the autologon has security issues of its own which can easily offset the benefits of disabling $ADMIN share)

share|improve this answer

You must log in to answer this question.

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