Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to open browser with specific url using ssh through a remote machine, i have enabled password less connection, i am able to get command o/p which run on remote machine using ssh, but how can i open browser using ssh? Tried with "-X" option which will open remote machine browser in my machine ( considering i run ssh from my machine).

1). ssh client@IP_ADDRESS -X "firefox - this opens browser in my machine.
2). ssh client@IP_ADDRESS "firefox this command shows error saying Error: no display specified.

Basically, my requirement is , through my machine, i should launch browser with specific url in remote machine ( which is suse linux).

Any pointers are greatly helpful.


share|improve this question

migrated from Apr 16 '13 at 16:08

This question came from our site for professional and enthusiast programmers.

3 Answers 3

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

share|improve this answer
Thanks for the reply. This is what i tried, ssh client@IP_ADDRESS "/usr/bin/firefox --display=X11 -new-tab= .But i got error<br/>Error: cannot open display: X11 – cb24 Apr 16 '13 at 12:29
So did my example work for you? If so, mark it as accepted please, so other users can easily find the valid answer. – keks Apr 16 '13 at 12:32

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

ssh client@IP_ADDRESS "nohup sh $1" &
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 ( which looks like this

#read " as backquote
browserPID="ps aux | grep firefox | grep -vc grep";
if [[ "$browserPID" > 0 ]];
    killall -9 firefox
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
this would open on client.

Your pointers on solving this appreciated.


share|improve this answer

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.

share|improve this answer
pls see my reply above. @keks - no, it gave me error saying unable to open display. – cb24 Apr 16 '13 at 12:33
X11 is the protocol used to talk to the server, not the identifier for the server. – Quentin Apr 16 '13 at 12:38
Thanks for the reply. Below command seems to be partially working, i wrote a small script in remote machine its like, #!/usr/bin/sh no="ps aux | grep firefox | grep -vc grep"; if [[ "$no" > 0 ]]; then killall -9 firefox fi firefox --display=:0 $1 & , and i launch this command through my machine ssh client@IP_ADDRESS "nohup sh", this seems to be parially working, but its getting stuck in my machine, i need to pass Cntrl+C to come out. Is there any way to come out without passing Cntrl+C. – cb24 Apr 16 '13 at 12:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.