20

I have CentOS 7 in the cloud where I can do only remotely ssh [email protected].

But remotely, how can I run a session of Google Chrome or Chromium on it and see the GUI remotely to browse remotely?

I have already tried all the references but none solve it. I am connecting from OSX 10.12x to CentOS 7.

Step 1:

$ which xauth
/usr/bin/xauth
$ cat /etc/ssh/sshd_config | grep X11
X11Forwarding yes
X11DisplayOffset 10
#X11UseLocalhost yes
#X11Forwarding no
$ systemctl restart sshd.service
$ systemctl stop iptables.service

Step 2: Failing?

$ echo $DISPLAY

$ ssh -v -X [email protected]
...
debug1: X11 forwarding requested but DISPLAY not set
...
$ export DISPLAY=:0.0 && xclock
xclock Error: Can't open display:

$ chromium-browser https://icanhazip.com
[28207:28207:0323/200459.551890:ERROR:browser_main_loop.cc(272)] Gtk: Locale not supported by C library.
    Using the fallback 'C' locale.
[28207:28207:0323/200459.557234:ERROR:browser_main_loop.cc(272)] Gtk: cannot open display:
3
  • What are you connecting from? Is it a Unix-like machine (Linux, *BSD, macOS...) or a Windows machine? Commented Mar 23, 2017 at 14:45
  • See my above EDIT section please. still failing from OSX to CentOS7. Commented Mar 23, 2017 at 20:07
  • Actually I've two linux machines connected via ssh -X and chromium is the only application opening on the wrong display, xterm or firefox open in the correct one, as if chromium isn't honouring the environment DISPLAY Commented Dec 21, 2018 at 0:01

4 Answers 4

9

First you need uncomment this lines in /etc/ssh/ssh_config on server:

X11Forwarding yes

The second step is connect to server with -X and execute Chromium

ssh -X user@hostname chromium

You will see it on client computer.

4
  • you have a firewall? Commented Mar 23, 2017 at 9:06
  • See my above EDIT section please. still failing. Commented Mar 23, 2017 at 20:07
  • 1
    Thank you so much! Finally something which worked flawlessly! On my Raspbian the conf file is not /etc/sshd_config, but /etc/ssh/sshd_config and the final command is ssh -X user@hostname chromium-browser Commented Dec 12, 2021 at 21:42
  • Thanks. I've edited the post. Commented Jan 12, 2022 at 11:12
4

Did you try X forwarding option in ssh? ssh -X or ssh -Y, or enable remote desktop service

1
  • See my above EDIT section please. still failing. Commented Mar 23, 2017 at 20:06
3

You are probably missing an X11 Server on the Mac Side. An X11 server used to ship with OS X, but doesn't anymore, however the XQuartz Project provides working client and server libraries and binaries for OS X (even Sierra).

You can run xauth, and export DISPLAY=blah, and xclock all you want, but if you don't actually have an X-compatible display server (and the display on OS X is not X-Windows), it will all be for naught.

XQuartz is also Apple's official recommendation for X on OS X, too.

Once you get XQuartz installed, you should have a much better experience X-Forwarding applications, and at that point some of the other answers in this thread should get you going.

0

The quickest way is using X11 forwaring, as others suggested, you need to have xserver installed on the remote local machine.

Well explained here: https://unix.stackexchange.com/a/12772/222357

Edit: as @Jakuje correctly pointed out, on remote machine there's no need to install xserver

4
  • 1
    no. You need the X server on the local machine. Commented Mar 23, 2017 at 9:43
  • xauth has to be installed on the remote machine Commented Mar 23, 2017 at 11:25
  • So what are you trying to ssh from - if you do "echo $DISPLAY" on your local machine, do you get ":0.0"? Commented Mar 23, 2017 at 15:54
  • See my above EDIT section please. still failing. Commented Mar 23, 2017 at 20:06