Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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. zweije.home.xs4all.nl/xauth-7.html If you find something useful here, repost what worked as an answer. –  Zoredache Nov 7 '11 at 23:50
add comment

2 Answers

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: http://www.howtoforge.com/reverse-ssh-tunneling

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

share|improve this answer
add comment

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

Follow this tutorial: http://maketecheasier.com/use-ssh-x-forwarding-to-run-remote-apps/2009/06/22

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
add comment

Your Answer

 
discard

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.