Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Running Windows executable on unix

by sara2005 (Scribe)
on Sep 28, 2005 at 13:20 UTC ( [id://495724] : perlquestion . print w/replies, xml ) Need Help??

sara2005 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I have a web application running on Apache web server (Unix Platform) using Perl-CGI. I run some unix executables from this web page and it works perfectly.

But, I do have some windows executables that have to run from the web application. These executables can be executed on the local windows machine or from a windows server. I am not sure how to go about this.

Can someone throw some light on how to go about this if it is possible?

2005-09-29 Retitled by g0n, as per Monastery guidelines
Original title: 'Running Windows executable'

Replies are listed 'Best First'.
Re: Running Windows executable on unix
by shonorio (Hermit) on Sep 28, 2005 at 13:52 UTC
    Sara2005
    You can install OpenSSH for Windows on yours Windows machines and use secure shell to execute your program remotely.

    Solli Moreira Honorio
    Sao Paulo - Brazil
Re: Running Windows executable on unix
by ZlR (Chaplain) on Sep 28, 2005 at 13:55 UTC
    You want to run windows executables through a webserver runing on a unix server ? Ouch ...

    If it's a Linux server think I would try to wrap the windows exe with something like wine to make them runable under the unix server and them call them like cgi through apache.

    I think other solutions will involve having a unix script comunicating with a windows machine to run the binary thus using some kind of Remote Procedure Call . This is certainly possible but i really don't know how .

    A low tech solution would be as you say to execute the windows binary on the local client. This could be done by suplying a file with a special mime type that would be associated with the correct application on the local client machine. It will prompt the user "do you want to execute this" and will generate the result, most likely in another browser window ... Not very clean, i guess .

    Update Ah, yes : shonorio proposes open SSH on the windows machine ... That's seems like a good way to do solution 2 .

Re: Running Windows executable on unix
by benrwebb (Scribe) on Sep 28, 2005 at 13:59 UTC
    The previous comments will get your windows commands executing. I wanted to make sure you understood that you can't execute code on a client computer from the server (or at least you shouldn't be able to). This is for security reasons, imagine the fallout if any website could execute arbitrary commands on client machines. With that power, any given website could take data off of your hard drive (think quicken files or other financial records) and then erase (or worse change) that data so you couldn't use it any more.
Re: Running Windows executable on unix
by TGI (Parson) on Sep 28, 2005 at 16:19 UTC

    In any case you will need some sort of server process running on the Windows box. For security reasons, you will want to strictly control what commands/programs can be executed on the windows system, and what information can be passed to them.

    If you use ssh, you'll want to create a special user who hase very, very strictly limited access. Really any server process should run at a low level of permission, but with ssh we are granting the ability to remotely execute arbitrary commands and so the need for limits is particularly great.

    Another approach would be to run apache (or another httpd) on the win-box, and write some perl CGI wrappers that do some policing of incoming data before executing the commands. You could even replace apache and run your perl scripts as daemons/services and connect directly to them.

    I lean strongly toward letting apache handle your windows server needs and using CGI scripts to filter your parameters--your UNIX server can access the CGIs in relative safety. This way you aren't adding any new technologies to the soup, which should ease the maintenance burden. You also benefit because there are well known techniques for securing apache.


    TGI says moo

Re: Running Windows executable on unix
by marto (Cardinal) on Sep 28, 2005 at 14:11 UTC
    Hi sara2005,

    I think that it would help if you updated your post with more information on what you are trying to achieve. Please provide as detailed a description of what you are trying to do and what tools (servers involved, software etc...) you have at your disposal.

    Are you trying to run MS Windows exes from with your Web App that is running on your Unix server?
    Are these exes on a local Windows based server that you have access to?

    Thanks

    Martin
A reply falls below the community's threshold of quality. You may see it by logging in.