Jelle
Jelle

Reputation: 1050

Open a program in linux using a web interface

Is there any way to open a program such as a webbrowser on a linux machine using a webinterface? I tried a simple cgi script

#!/bin/bash
echo "Content-type: text/html"
midori
exit 0

But I'm getting a response on the page the browser can't open an interface...

Upvotes: 0

Views: 124

Answers (1)

Bartlomiej Nogas
Bartlomiej Nogas

Reputation: 340

To avoid permissions problem make sure that the same user runs X server and web server.

You have to set two variables XAUTHORITY and DISPLAY. Try with this script:

#!/bin/bash
export XAUTHORITY=/home/<username>/.Xauthority
export DISPLAY=':0'
midori &

replace < username> with the username of the user who owns the X server process

Upvotes: 2

Related Questions