X11 Forwarding For Mac



If you are connecting to HCC clusters via a PC running Windows, please take the following steps to setup X11 forwarding.

X11 forwarding needs to be enabled on both the client side and the server side. On the client side, the -X (capital X) option to ssh enables X11 forwarding, and you can make this the default (for all connections or for a specific conection) with ForwardX11 yes in /.ssh/config. On the server side, X11Forwarding yes must specified in /etc/ssh/sshdconfig. May 02, 2017 X11 is no longer included with Mac, but X11 server and client libraries are available from the XQuartz project. Apple created the XQuartz project as a community effort to further develop and support X11 on Mac. The XQuartz project was originally based on the version of X11 included in Mac OS X v10.5. I'm running a Ubuntu server in VMWare. And I would like to forward the X11 from the Ubuntu guest to the Mac host. I've installed XQuartz 2.7.9 (xorg-server 1.17.4) on the Mac host. And SSH forwarding on the Ubuntu is enabled. Then I tried the following in iTerm. To test if we have set up X11 forwarding correctly, we try to run mathematica. Run the following commands: $ module load mathematica $ mathematica. You should see something like this: You now know how to run X Forwarding on Mac! By default, PuTTY should have the port set to 22, and connection type should be set to SSH.

  1. Download Xming to your local PC and install. Downloadlink: https://downloads.sourceforge.net/project/xming/Xming/6.9.0.31/Xming-6-9-0-31-setup.exe
  2. Download PuTTY to your local PC and install. Download link: http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe
  3. Open Xming and keep it running in the background.
  4. Configure PuTTY as below:

  5. To test your X11 setup, after login, type command xeyes and pressenter.

  6. Close the xeyes application by “Ctrl + c” from the terminal or clickthe close button on the up-right corner of the graphical window.

If you are connecting to HCC clusters via a Macintosh, please take the following steps to setup X11 forwarding.

For
  • Check the OS version on your Mac, if it’s below 10.8., you can simply type ssh -Y username@hostname in your terminal to login.

  • If your OS version is newer than 10.8, please do the following:

    1. Download and install XQuartz.Download link: https://dl.bintray.com/xquartz/downloads/XQuartz-2.7.11.dmg
    2. Type ssh -Y username@hostname in your terminal to login.
    3. To test your X11 setup, after login, type command “xeyes” and pressenter.

    4. Close the xeyes application by “Control + c” from the terminal orclick the close button on the up-left corner of the graphicalwindow.

If you are connecting to HCC clusters via a Linux laptop, please take the following steps to setup X11 forwarding.

  1. Open the remote client terminal.
  2. Type ssh -Y username@hostname” in your terminal to login.
  3. To test your X11 setup, after login, type command “xeyes” and pressenter.
  4. Close the xeyes application by “Ctrl + c” from the terminal or clickthe close button on the up-right corner of the graphical window.

Special note about Indirect GLX

If you are using OS X or Linux, you may need to re-enable indirect GLX (IGLX) in order forthe GUI application to run properly. IGLX was disabled for security reasons starting withX.org version 1.17 (Linux) and XQuartz version 2.7.9 (OS X). More information about thischange is available at this link.

To re-enable IGLX, use the follwing instructions:

OS X

Open a terminal on your Mac, and run the following command:

Log out or restart your Mac for the changes to take effect.

Linux

You will need to create a small Xorg configuration file. This requires root access, sorun commands with care.

Be extremely cautious running commands as root. You can permanently make your system unusable.

Mac

Create a file at /etc/X11/xorg.conf.d/iglx.conf with the following contents:

Restart X11 by logging out, or by rebooting your machine.

Related articles

SshOpenSSH server on Debian 10 supports X11 Forwarding. So, you can not only manage your server remotely via SSH, you can also install a graphical user interface on your server, enable X11 Forwarding and use the graphical applications installed on the server remotely. In this article, I am going to show you how to configure X11 forwarding on Debian 10 Buster and use graphical applications installed on the server remotely via SSH. So, let’s get started.

If your server doesn’t have openssh-server package installed, you must install it from the official package repository of Debian 10.

First, update the APT package repository cache with the following command:

X11 Forwarding For Mac High Sierra

The APT package repository cache should be updated.

Now, install openssh-server package with the following command:

openssh-server package should be installed.

Now, open the OpenSSH server configuration file /etc/ssh/sshd_config with the following command:

Now, locate the lines X11Forwarding, X11DisplayOffset and X11UseLocalhost, uncomment them (by removing #) and set X11Forwading to yes, X11DisplayOffset to 10 and X11UseLocalhost to no.

The final configuration file is shown in the screenshot below. Once you’re done, save the configuration file by pressing <Ctrl> + X followed by Y and <Enter>.

Now, restart the sshd service with the following command:

Now, check whether the sshd service is running with the following command:

As you can see, sshd service is running. It’s also enabled. So, it will start automatically on boot.

If the sshd service is not running in any case, then start it with the following command:

If the sshd service is not enabled, then, enable it with the following command.

Mac

Configuring the Client:

To connect to the remote server for X11 forwarding via SSH, you need to know the login username and the IP address of the remote server.

You can find the login username of the remote server with the following command:

Forwarding

You can find the IP address of the remote server with the following command:

In my case, the IP address is 192.168.21.131 and the username is shovon. It will be different in your case. Make sure to replace these with yours from now on.

On your client computer, you must have openssh client tools installed.

On Ubuntu/Debian machines, you can install openssh client tools with the following command:

Now, login to the remote server for X11 forwarding with the following command:

Mac Os Ssh X11 Forwarding

If you’re SSHing into the remote server for the first time, then you will see the following prompt. Just type in yes and press <Enter> to continue.

Now, type in the password of the login user of the remote server and press <Enter>.

You should be connected to the remote server.

Now, to run a graphical application over SSH, run the command that starts the program.

For example, to start wireshark, run the following command:

Wireshark should start on your client computer as you can see in the screenshot below. Wireshark is actually running on the remote server. But, you can use it from the client computer without having it installed on the client computer. Nice isn’t it!

If you run a graphical application like I’ve shown above, you won’t be able to use SSH to run any more command on the remote server.

To run a graphical application remotely and still able to run other commands, start the program as follows:

This way, the graphical application process will run as a background process and the shell will be usable.

Problems Running GNOME Apps Remotely:

If you’re logged into the remote server already and try to run a GNOME official software such as Gedit, GNOME Disks remotely over SSH. The program will run on the remote server, not on the client as you can see in the screenshot below.

Command executed on the client

Gedit started on the remote server, not on the client.

To solve this issue, you must log out on the remote server.

Then, you should be able to run official GNOME apps remotely over SSH. As you can see, I am running Gedit remotely. It’s working just fine.

I can also use GNOME System Monitor.

GNOME Disks works as well.

X11 Forwarding Docker Mac

So, that’s how you configure SSH X11 Forwarding on Debian 10 and access graphical applications remotely. Thanks for reading this article.