简体   繁体   中英

Invoking an application running on mac vmware from parent Windows OS

Is there a way we can invoke an application installed on mac lion vmware from a program or web application running on windows OS?

Thanks,

Configure remote login on the Mt Lion instance,

共享设置

Now you can connect over SSH, and invoke commands. (on Windows use Putty / Plink )

eg if your VMWare instance is on 10.0.0.1 and login is username.

plink 10.0.0.1 -l username "open -a Chromium.app http://google.com"

Setup ssh keys to do this without password challenges.

If you weren't running windows...

Just do an ssh call.

ssh username@10.0.0.1 "open -a Chromium.app http://google.com"

Alternatively

Run a very simple web service on the Mac, and have it run commands supplied locally.

This is pretty easy if you use Sinatra or something lightweight and similar (sammy.js for node is apparently based on sinatra.)

Do something like this, from the Mac terminal:

sudo gem install sinatra

create a file called app.rb

require 'sinatra'

get '/' {
   `#{params[:command]`
}

Then launch it:

ruby app.rb

Now open the following URL on the windows box

http://10.0.0.1:4567/?command=open%20-a%20TextEdit.app

Again, assuming the VM instance IP address is 10.0.0.1

TextEdit will open on the Mac VM.

Security & notes...

This would allow any command that is at the privilege level of the logged in user, fine for launching apps, but not good for anything that requires further interaction, for that you're better off writing a local script on the Mac VM and calling it via similar means to those I've described.

Secure it...

Of course no security on this, but you could add it reasonably simply, if ssh wasn't possible, and it'd depend on your requirements.

Adding a simple security token to the request:

get '/' {
   `#{params[:command]` if params[:token] == "awSomEl3yS3cuReP4ssK3y"
}

Sending the request as:

http://10.0.0.1:4567/?token=awSomEl3yS3cuReP4ssK3y&command=open%20-a%20Safari.app

You can beef it up further by various means, but this is enough to get you going. Rack (which sinatra uses to provide the http service, will allow you to setup modules, ie. basic http auth, or more advanced authentication, as you see fit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM