Suppose that there are 3 machines, A, B, C. B and C are on the same network, whereas A is remote. Connection between B, C is very fast, but any connection from A to (B or C) is slow.

I would like to run a computationally intensive job on C involving graphical output (namely, generating png files from MATLAB). If I SSH from A -> B -> C, the X11 output is displayed on A. I would like to SSH from A -> B and run the same computations on C, but have all graphical output confined to B, so that the slow A -> B connection does not make the job take forever (this is what is happening to me now). Is this possible, and if so, how should I set it up?

Operating systems: A is OSX, B is Ubuntu, C is CentOS (part of computing cluster).

  • Can't you save the output to disk instead? Sep 6, 2016 at 3:04
  • @MichaelHampton. It turns out that to save the output to disk on C, an X11 connection is required from the machine requesting the job (or at least, I am told that this is the case). Sep 6, 2016 at 3:06

1 Answer 1


Well, forgive me if I'm over simplifying this, but wouldn't the simplest solution be to ssh from A to B (without X11 forwarding), and then to ssh (with X11 forwarding) from B to C. If you need the graphical interface to start the job, you could start by having the X11 forwarding option enabled for the connection from A to B, then disconnect (A from B, but not B from C) and monitor the job via an SSH with a X11-disabled connection after the job is started.

It sounds like you have X11 forwarding working and enabled by default, so you should be able to switch it off when you re-ssh w the following line:

ssh user@hostB -o "ForwardX11=no"

EDIT: Of course, this assumes you're able to start an X11 forwarding ssh session to C from B. Is that the case? If not, could you post the line you use to start your tunneled session? This could honestly get complicated depending on your details.

  • Yes, this is it. It turns out that we have X11 forwarding as a default. Thanks! Sep 7, 2016 at 16:28

You must log in to answer this question.

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