28

Is it possible for me to SSH to another server in Linux (Ubuntu), run a program there but display it locally?

And is it possible for me to SSH to another server in my terminal, and configure it so that all graphical programs (Firefox, Emacs) run in that SSH session will be displayed locally?

Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
michael
  • 5,755
  • 24
  • 66
  • 83

4 Answers4

33

By adding the "-Y" flag to the ssh command, the display will automatically be redirected to your local computer.

ssh -Y <remoteip>

Then, if you start Firefox (or any other X application) in that ssh session, it will be displayed locally. (If you have a xserver running locally of course)

Nifle
  • 34,203
  • 26
  • 108
  • 137
  • 2
    I will use `-X` since this way forwarding is subjected to `X11 SECURITY`. But if you trust the remote machine then you can use `-Y`. – fmanco Jul 12 '12 at 11:34
  • 1
    Under Unixes like HP UX 11i, -Y is the way to go due to incompatibility issues with -X. – Owl Oct 08 '18 at 21:27
  • does this work when the remote machine is Windows? I can get it to display. – Mark Deven Jan 19 '19 at 21:19
5

You are looking to do remote X. This is a good mini HOWTO.

mindless.panda
  • 7,262
  • 13
  • 47
  • 66
4

You can also use compression when using X-forwarding:

ssh $HOSTNAME -CY $PROCESS
usered
  • 3
  • 2
Vaibhav Bajpai
  • 553
  • 9
  • 14
3

You might also want to try this:

ssh <hostname> -X <program-name or its full path>
Xolve
  • 470
  • 2
  • 11
  • 26