Opening Browser in remote machine through ssh

You need to set the DISPLAY environment variable. See env |grep DISPLAY. So basically you could use something like export DISPLAY=:0; firefox http://google.de.


Thank you all for the reply. I got this working with the help of 2 scripts
On Server side ( or in my machine) i have a script which looks like this

#!/bin/bash
ssh client@IP_ADDRESS "nohup sh openBrowser.sh $1" &
PID=$$;
echo "PID IS |$PID|\n";
sleep 3 && kill -9 $PID;

On the client side ( where i need to open browser remotely i have a script ( openBrowser.sh) which looks like this

#!/usr/bin/sh
#read " as backquote
browserPID="ps aux | grep firefox | grep -vc grep";
if [[ "$browserPID" > 0 ]];
then
    killall -9 firefox
fi
nohup firefox --display=:0 $1 &

Also point to ensure that, i have created password less connection using ssh-keygen.
On the server i call the script (first one) as
sh launchBrowser_client1.sh http://google.com
this would open google.com on client.

Your pointers on solving this appreciated.

Thanks.


You need a display to run it on. You specify that display using the DISPLAY environment variable.

If you don't want to shove all the data over SSH then you need to use an X11 server on the machine you are connecting to. This could be a headless server such as xvfb.