I've hooked up the raspberry pi to a display. I have ssh'd in from another machine and I was wondering how, if possible, to open a browser window via epiphany http://example.com from my ssh session and have it appear on the screen.
3 Answers
Presuming you are logged in as the same user that's running the X display, this is fairly easy. First you need to know the display identifier; if there is only one running instance, it is probably :0. To check, use who. You'll see output including stuff like this:
goldilocks pts/5 2015-02-16 07:18 (:1)
goldilocks pts/6 2015-02-16 07:18 (:1)
goldilocks pts/7 2015-02-16 07:36 (:1)
The display identifier is in parenthesis at the end, in this case :1. You need to set that in the environment of your ssh session. For most shells including bash (the default on raspbian):
export DISPLAY=:0
Or :1, as the case may be. To now start epiphany there:
epiphany http://example.com &
The & backgrounds this, otherwise it will block and you won't get the prompt back in ssh.
- 60,325
- 17
- 117
- 234
As an addition to Goldilocks' answer, for epiphany you can set the display using the --display option:
epiphany --display=:0 http://example.com &
ssh -o ForwardX11=yes pi@192.168.0.37
Open an ssh with X11 port forwarding and you can run some Xwindows command from the terminal
ssh -o ForwardX11=yes <userName>@<your pi's hostname or ip address>
- 2,929
- 3
- 26
- 34
- 101