How to execute a command on a Linux machine from a webpage?
I usually use PuTTY to execute commands on a Linux machine. But I wish to make a webpage from where I can execute specific commands on a Linux machine by simple button clicks. W开发者_JAVA百科hat are the various options available and what is the one that is easy to implement?
This depends on the kind of server you are running. But almost all servers have some kind of CGI support or an equivalent. Keep in mind that this can often cause a security issue.
I don't think you can and should try to embed script code in your page.
The best suggestion may be to hyperlink a script file and let the user get it from your server.
Just put that file on the server and then hyperlink it.
securewebcmd can do this for you
- can use http or https
- password protected
- password not transmitted in clear, even using http (hashes the commandline with the password, and server does the same thing, using its copy of the password, and only runs the command, if the hashes match)
- can queue commands, which run sequentially
- can view results of any of the commands you've run earlier, even if you restart the server
- uses nodejs: no dependency on any heavyweight server, ie no need for apache, jboss etc ...
精彩评论