0

Cannot Launch Firefox using SSH Putty

Description

I am trying to to setup a headless web server and I need the firefox browser to do some configurations. I am currently using windows Putty to SSH to my VM running on RHEL 8. I believe I have installed the correct packages needed to install firefox and enabled both X11 Forwarding on both the Server and Client. Below are the details to what I've done so far.

Error Problem:

In Short, firefox does not launch.

$ export DISPLAY=:0.0
$ xhost +
access control disabled, clients can connect from any host
$ firefox &
[1] 151163

I have done the following:

On Server Side

  1. Installed firefox and prerequisite packages (on server)
  2. Installed xauth & xorg-x11*
  3. Configured /etc/ssh/ssh_config (FowardX11 yes, FowardX11Trusted yes)
  4. Configured /etc/ssh/sshd_config (X11Forwarding yes, X11DisplayOffSet 10, X11UseLocalhost yes, AllowTcpForwarding yes)

On Windows Client Side

  1. Installed and configured X Server(XMing)
  2. SSH with X Forwarding via Putty (With X11Forwarding enabled, X Display location: localhost:0.0)

I have enabled X11Forwarding on both Server and Client. Can someone tell me why am I still facing this error?

6
  • 1
    export DISPLAY=:0.0 This shouldn't be necessary. If X is being forwarded, the SSH server will set DISPLAY to the correct value for you. On top of that, ":0.0" isn't likely to be the correct value for your purpose. Try running ssh with the "-vv" flag to print debugging output, then edit your question to include the debugging output.
    – Kenster
    Sep 19, 2020 at 20:08
  • Hi thanks for your help, I've edited my post which returns another error instead. Anyway, how do I set -vv flag in order to print the debug output? Do i set it in Putty? Can you give an example? Thanks!
    – Noose780
    Sep 19, 2020 at 20:12
  • Sorry, I didn't realize you were using putty. Putty does have a debug log, but I can't talk you through it.
    – Kenster
    Sep 19, 2020 at 20:13
  • It's fine. But from the edited post, can you tell what is the latest error mean?
    – Noose780
    Sep 19, 2020 at 20:14
  • Are you aware that the & backgrounds the firefox process? That means you won't get the GUI to open over X11 forwarding (working or not), it will run in the background and be inaccessible for normal usage.
    – dza
    Sep 19, 2020 at 21:39

1 Answer 1

1

Why do you need to run Firefox on the server itself?

It's not only unsecure but also slower than local Firefox as it sends images over the network instead of simple HTTP traffic.

You can achieve the same with SOCKS proxy. To configure this, you can go in Putty to Connection->SSH->Tunnels, then add new one with source port like 8888, destination port empty, then Dynamic, Auto.

This will add local socks proxy listener, which will see the network from perspective of the server. Then you go to your locally installed Firefox (on the machine with putty) proxy settings and set there socks proxy, with IP 127.0.0.1 and port of you choice (8888 here). To not interrupt with your usual activity, you can create a seperate Firefox Profile in about:profiles, and you don't need to decrease security by all with this X11 related configuration on server side and XServer on Windows machine

5
  • That is pretty some information that I need to digest. So from my understanding.. you're suggesting that I use SOCKS proxy instead of X11 Forwarding
    – Noose780
    Sep 19, 2020 at 20:16
  • Yes, the only drawback is you need to configure some part clientside, not sure how many users would use that solution but definiately easier than building multiple X11 @ Windows stations. And you will avoid some secuirty concerns like X server having access to your Windows clipoard and ability to access this by other users of same X server. You can also go with local port forwarding in Putty, then access and service under local port like 127.0.0.1:8443 forwarding you to server_ip:443 . But you need one forwarding per each accessed service - depends how many of them you need
    – nusch
    Sep 19, 2020 at 20:25
  • I managed to find a similar solution linuxize.com/post/… that i can follow. Will this allow me to access firefox remotely via ssh?
    – Noose780
    Sep 19, 2020 at 20:30
  • I agree, in this scenario a ssh tunnel is the better or less complex solution and will not pollute remote server with Firefox+dependencies
    – dza
    Sep 19, 2020 at 21:40
  • I spent the 2 days trying to display firefox remotely with X11 Forwarding using Putty. You guys solved my problem! This is a great solution!
    – Noose780
    Sep 20, 2020 at 6:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .