Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was playing with my phone (that runs a Linux/X stack) last night and I managed to ssh into my desktop and run an application and have it show up on my phone. It was awesome.

Today I'd like to sort of do the opposite. I want to view an application running on my phone on my PC. I could install a SSH server on my phone but I frankly don't fancy that purely for security reasons. I want this to be initiated from my phone.

Is there a way to connect from my phone and tunnel the PC's X connection back to the phone and then run an application on the phone that show on the PC?

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

If I understood it correctly you just need to use the DISPLAY variable on your phone to redirect the applications display to your desktop.

On your desktop:

xhost +phone_ip

On your phone:

export DISPLAY=desktop_ip:0

start app

share|improve this answer
    
But I need this tunnelled over SSH. And to the PC the connection would look like it was coming from a localhost (where the ssh server is) so I'm not sure it needs xhost. My understanding of this gets a bit blurry because I don't know what TCP port X runs on. I don't know what I'm supposed to forward and I don't know how to construct the DISPLAY=... statement on the phone to use the forwarded port. –  Oli Nov 4 '10 at 10:12
    
Actually I should notice that with GDM X is started with "-nolisten", you can check that with: ps -ef | grep nolisten. You will need to change that to start with. I am not sure how to change it. Once X is listening I believe the TCP port is 6000 + display nr –  João Pinto Nov 4 '10 at 10:30
    
Urgh. At that rate it might just be easier to run a SSH server on my phone that only binds to localhost. From there I could SSH to my desktop and run another SSH connection back (tunnelled over the first) with X forwarding and in that run the program. Sounds nasty. –  Oli Nov 4 '10 at 11:02
add comment

"reverse ssh tunnelling" or "remote port forwarding" is your friend.

issue this on the phone

ssh -f -N -X -R 5555:localhost:22 desktop_user@desktop

then, on the desktop this

ssh -X -p 5555 phone_user@localhost

share|improve this answer
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.