ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello all, i have just joined this forum.
There is a question that i need an urgent solution to.
How do i open a terminal from an HTML page?
I need to do this, to open a terminal, and run a bash script.
Please help.
Do you wan the script to run on the browser host, or on the server host? If on the browser host, you will probably (hopefully) find that extremely difficult, or impossible. If a browser permits arbitrary scripts and applications to run on it's host, that represents a security risk of monumental proportion. If the script is to run on the server host, then generic CGI techniques should be present. It will require you to have access to the server in order to create your script, and the sphere of access to the filesystem will probably be quite limited without some significant reconfiguration of the server (and which you should consider very very carefully).
Actually, i know the xterm solution, and i have done the same in my bash script. The real problem is in putting a link on an html page, on clicking on which my bash script to open a terminal n run a program should run.
But thank you all for the suggestions. Please suggest something for this. Thanks everyone.
So, you've reiterated the question. Will you answer the question posed to you? If not, it will be difficult to suggest anything. If your question is so urgent, it would be in your best interest to help those who are trying to help you.
Well, on the host used to run the web browser one can activate an HTTP server as an independent process which starts running before the web browser. And the server will have a local host IP address, e.g. 127.0.0.0 ad will be listening on some port, say, 8080.
The URL that is supposed to invoke a bash script should point to that local host server and port, e.g., as stated above, 127.0.0.0:8080, and the local server will invoke the needed script. Which can reside, for example, in cgi-bin.
So it won't be just a security hole, it will the needed by design security hole .
You need to answer the questions that have been asked of you before anybody can be of any help.
Namely, who is the server, who is the client, and where is this terminal supposed to run? Does it need to be a graphical terminal that actually opens up on the machine (if so, which machine?), or does it just need to run a script on the machine (if so, which machine?)
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
Rep:
I read this request differently to others, it seems.
As I read it the OP wants to have HTML files stored locally (probably in a home folder) which contain links to scripts in that folder. One would then click on one off these links and the terminal would open and the script run.
This is something I could see being done under Windows with batch scripts but I wouldn't know how to start under Linux.
One would then click on one off these links and the terminal would open and the script run.
This is something I could see being done under Windows with batch scripts but I wouldn't know how to start under Linux.
I just tried this on my Windows box here, Firefox and Chrome just open the bat file as plain text, Internet Explorer asks whether to run or save. Maybe it's possible to configure the browser to run directly, in any case it would be a browser specific rather than OS specific issue.
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
Rep:
Quote:
Originally Posted by ntubski
I just tried this on my Windows box here, Firefox and Chrome just open the bat file as plain text, Internet Explorer asks whether to run or save. Maybe it's possible to configure the browser to run directly, in any case it would be a browser specific rather than OS specific issue.
Yeah, I couldn't be bothered to break out Windows in a VM to try it but I think I have done something similar in the past with IE either file associations of security zones.
I would expect that because, as you say, it could be browser specific, you could tell Firefox to open scripts with the terminal but it would probably rely on setting a file extension or something.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.