Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose I've computers office and home. I want to connect from home to office through ssh and run a program from home that opens a window, let say emacs, on the office screen. Is it possible?

share|improve this question
So are you asking if you can run X11 programs on office, when you start them on office, via an SSH session to office? This is absolutely possible. – Zoredache Nov 7 '11 at 23:31
yes, connetting from home. But I want to show the program on the office monitor, not on home monitor – wiso Nov 7 '11 at 23:41
xauth gives me a headache, but check out this link. If you find something useful here, repost what worked as an answer. – Zoredache Nov 7 '11 at 23:50

It depends on what permissions you have on the office machine and where you want the program to execute. If you're happy to have the program using the filesystem and CPU of the office machine then you can just execute a command with DISPLAY=:0, assuming that you have the relevant permissions (some distributions will require you to have a login at a the local machine before you can use the hardware on it).

If you want the program to run on home but display on office the best way would be to use SSH's reverse port forwarding feature. This will allow you to connect back from office to home via the initial SSH connection. You could forward the port for X, but I think there's more than one, and then you would need to set $DISPLAY manually, so I would recommend forwarding the SSH port.

See the -R option in the ssh manpage.

This should help:

Example: user@home$ ssh -R 20000:localhost:22 office user@office$ ssh -p 20000 localhost

share|improve this answer

yes it is possible. You need to enable X-Forwarding on ssh server (in your case home computer).

Follow this tutorial:

share|improve this answer
no, this is not what I'm asking. This is a normal X-forwarding from office to home, I want to do the reverse. I'm sittining on my home computer, and I want to open a window on my office computer, running a programin on 'office' – wiso Nov 7 '11 at 22:35
so you want to remotely issue commands on office computer? why not use any remote desktop or remote control utility for this purpose? – Farhan Nov 7 '11 at 22:41
with a remote desktop I can visualize office desktop on home screen, this is not what I want – wiso Nov 8 '11 at 8:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.