Skip to content

SSH X forwarding

SSH X forwarding (or simply 'X forwarding') allows one to use graphics when using an SSH client.

For example, this is how UPPMAX user sven would login to Rackham using ssh with X forwarding enabled:

ssh -X sven@rackham.uppmax.uu.se

It is the -X that allows ssh to show graphics.

What is X?

In this context, the X window system.

How can I verify I allow X forwarding?

In a terminal, type:

xeyes

If you have X forwarding enabled, you will see:

SSH X forwarding is enabled, as there are eyes shown in the top-right of the screen

If you do not have X forwarding enabled, you will get the error:

Error: Can't open display:

SSH X forwarding is not enabled, as this gives an error message

UPPMAX clusters that allow SSH with X forwarding

Cluster Allows SSH with X forwarding
Bianca No
Rackham Yes
Snowy Yes

SSH clients

See SSH clients.

Difference between ssh -X and ssh -Y

Adapted from this AskUbuntu answer:

If you need graphics, ssh -X is more secure. However, it may be too secure for your software to run. In that case, run ssh -Y.

flowchart TD
  need_graphics[Need graphics?]
  ssh[Using 'ssh' works]
  try_ssh_x[Try to use 'ssh -X'\n Does it work?]
  ssh_x[Use 'ssh -X']
  ssh_y[Use 'ssh -Y']

  need_graphics --> |no| ssh
  need_graphics --> |yes| try_ssh_x
  try_ssh_x --> |yes| ssh_x
  try_ssh_x --> |no| ssh_y

Flowchart to determine to use ssh or ssh -X or ssh -Y.

Using ssh -Y? Let us know!

If you -a user- use ssh -Y when ssh -X does not work, let us know (see the UPPMAX support page here). It helps us choose which option to show at these documentation websites.