Snowleaf
Snowleaf

Reputation: 67

how to open terminal with firefox?

I have an executable file with .sh extension. I want to open this file through firefox with Terminal but it return an error:

"filename.sh" can't be opened because Firefox is not allowed to open documents in Terminal.

now, how can I change the permissions to resolve this out?

Upvotes: 3

Views: 5289

Answers (2)

Peter Bauer
Peter Bauer

Reputation: 294

A more secure method working in all modern browsers with javascript can be found here:

  1. Install the websocketd server (single static linked binary) download from http://websocketd.com/

  2. Start the websocketd server:

    ./websocketd --port=8080 --devconsole ./command.sh

  3. Write an HTML page and a small bash script

HTML:

     <button type = "button"
                  onclick = ws.send("xterm\040#started")>xterm </button>

Javascript open a websocket:

          var ws = new WebSocket('ws://localhost:8080/');

Bash script(command.sh):

        #!/bin/bash
        export DISPLAY=:0.0
        while read command
          do
            eval $command
          done

more details: http://www.bitkistl.com/2016/01/websockets-with-interactive-bash-script.html

Upvotes: 1

Thomas Dickey
Thomas Dickey

Reputation: 54563

It is normally disabled because it can allow malware to damage your files. For instance this STIG Viewer topic Network shell protocol is enabled in FireFox.

However, it is configurable, called the "Shell Protocol". The blog entry Firefox: Enable starting of scripts and applications from an HTML page goes into some detail, showing settings for

  • network.protocol-handler.external.shell (true)
  • network.protocol-handler.app.install (a custom shell)
  • network.protocol-handler.app.shell (a custom shell)

Upvotes: 0

Related Questions