Reputation: 103627
If I have a asp.net web app on a windows box (obviously!), and I need to execute a shell script that is on a linux server, is that possible?
How can I do this safely?
Upvotes: 0
Views: 1123
Reputation: 41902
Your best bet might be to expose the triggering of the shell script through some sort of web interface, like a secure web service.
Upvotes: 1
Reputation: 2141
To build on what cxfx has said above your best bet might be to set up a web server on the linux box, and build a web service using, for example, php.
php allows you to run shell scripts - so by calling a web page runscript.php and then using exec (http://php.net/manual/en/function.exec.php) you could run the script.
Security is a consideration - you could restrict access to the linux web server purely to the IP address of the server hosting your asp.net site?
Hope that helps.
Upvotes: 2
Reputation: 21175
One way of doing it is by logging through ssh. You can use the granados C# library for it. This will let you run arbitrary commands. If what you need is to always run the same command, you can take a different approach like a CGI script (hide it with at least HTTPS and user/password).
Upvotes: 1