Is there a way to launch firefox on a remote server using SSH this way ? :

ssh username@ip_address [command line]

When I run: ssh username@ip_address -Y (or -X) firefox (I want to launch firefox on the remote -Ubuntu Desktop- from my local -Ubuntu Server), I get this error: Error: no display specified

Important note: I want to run this command from an Ubuntu Server to an Ubuntu Desktop operating system.

  • You want the Ubuntu server (A) to issue a command to the Ubuntu Desktop (B) machine to run B's firefox on B's own display, correct?
    – Kos
    Jun 3, 2014 at 13:33
  • yes, that is exactly what i want to do
    – user223514
    Jun 3, 2014 at 13:34
  • Then SSH X forwarding isn't for you, it's helpful if you want to run firefox on B but have it displayed in X11 installed on A. You probably don't even have X11 in A because it's a server
    – Kos
    Jun 3, 2014 at 13:41
  • @Kos yes, you are right, I installed X11 server, but this means I am no longer using Ubuntu Server (but this is not a problem in my case). Thank you
    – user223514
    Jun 3, 2014 at 13:45

3 Answers 3


You can use X Forwarding to do that. Make sure that firefox is installed on your server, then from your desktop, run:

ssh username@ip_adress -Y [command line]

if -Y does not work, you can still use -X instead.

If it's not working, be sure that:

  • in /etc/ssh/sshd_config on the server, X11Forwarding is set to yes
  • in /etc/ssh/ssh_config on the client, ForwardX11 is set to yes. Add the line if needed.
  • xauth is installed on the server : sudo apt-get install xauth



  • It says: Error: no display specified
    – user223514
    Jun 3, 2014 at 8:50
  • Did you also try the -X option ? Can you provide the output of the command or tell us if you have other errors ?
    – Rabbit
    Jun 3, 2014 at 8:58
  • Yes, I run it with -Y then with -X options. In both cases I got only this error message:Error: no display specified
    – user223514
    Jun 3, 2014 at 9:03
  • Also, be sure that X11Forwarding is set to yes in /etc/ssh/sshd_config on your server.
    – Rabbit
    Jun 3, 2014 at 9:04
  • 1
    I never had such a situation... Try adding to /etc/ssh/ssh_config on the client the following line : ForwardX11 yes. Also, install xauth on your server : sudo apt-get install xauth
    – Rabbit
    Jun 3, 2014 at 9:13

This should get you rolling:

ssh machine DISPLAY=0:0 firefox

Just tried it with two Ubuntu machines.

The syntax FOO=asdf BAR=fdsa command arg arg2 isn't special to SSH, just sets environment vars for command. You need to tell Firefox where's the X11 display - in this case it's the same machine as Firefox. X11 forwarding isn't used because both Firefox and the X11 server are in the same box.

See also https://superuser.com/questions/368530/understanding-x-windows-display-environment-variable-when-tunnelling


Simple remote browsing

If you'd like to browse the web locally as if you were sitting in front of a remote box:

$ ssh -X username@remote.example.com

then run Firefox inside the remote terminal session:

$ firefox https://test-ipv6.com/

Notice the usage of -X flag in the ssh command. You can also do both steps in a single go, like shown below:

$ ssh -X username@remote.example.com firefox http://test-ipv6.com/

Tunnelling a remote IP:port

If you have an application running remotely which exposes some sort of web frontend, you will be interested on exposing the remote IP:port as if it is a local IP:port. In this case, the -L option defines a correspondence between localhost:localport and remotehost:remoteport, as shown in the pseudo command below:

ssh -L localhost:localport:remotehost:remoteport remoteuser@remotehost

For example:

$ ssh -L username@router.example.com

then run Firefox locally:

$ firefox

In the example above, you are connecting via SSH onto username@router.example.com, and you are interested on a web frontend exposed at internal.example.com:8080. This remote IP:port will be exposed locally at

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.