You are not logged in.

#1 2006-12-14 02:54:54

vasdee
Member
Registered: 2006-07-15
Posts: 55

open remote app via ssh [SOLVED]

this question has been on my mind for a while but i've never bothered to find out the answer... maybe a  kind archer can help? wink

I have my home machine running most of the time. Sometimes when i'm at work i think it would be handy to start up a bittorrent client via ssh on my home machine so i can download something and have it waiting for me when i get home. My question is, is there a way i can make a program load on my screen at home from an ssh session? I am logged in as the same user that has a gnome session running. I've tried messing around with the $DISPLAY environment var but haven't been able to work it out.  Is this possible?

Offline

#2 2006-12-14 03:02:41

ralvez
Member
From: Canada
Registered: 2005-12-06
Posts: 1,718
Website

Re: open remote app via ssh [SOLVED]

Yes, there is.
You run sshd at home, then from your office your connect to your system and issue a command in that machine and it is as good as if you are sitting at the console in your home machine.

It is practical to have screen (google for it and you will see what I mean) because you can log in, issue the command you want and then log off your home system and keep going   at whatever you need to do in the office, then say 2 hours later you re-log in using screen and you are exactly at the very same session you initiated earlier.

One more thing you may need to configure your firewall to let your office computer connect to your home computer.

Hope this helps.

Offline

#3 2006-12-14 13:00:50

vasdee
Member
Registered: 2006-07-15
Posts: 55

Re: open remote app via ssh [SOLVED]

screen eh? looks interestng, thanks smile

I was hoping there was a way to do it just with ssh and the DISPLAY environment variable but i'm guessing that's not possible then?

Offline

#4 2006-12-14 13:51:19

Romashka
Forum Fellow
Registered: 2005-12-07
Posts: 1,054

Re: open remote app via ssh [SOLVED]

vasdee wrote:

Sometimes when i'm at work i think it would be handy to start up a bittorrent client via ssh on my home machine so i can download something and have it waiting for me when i get home. My question is, is there a way i can make a program load on my screen at home from an ssh session? I am logged in as the same user that has a gnome session running. I've tried messing around with the $DISPLAY environment var but haven't been able to work it out.  Is this possible?

I suppose you want to run GUI program and see it via ssh on your screen, right?
Then the best way is FreeNX.
Alternatively, you may want to use CLI bittorent client, i.e. rtorrent, transmission (it has transmission-cli program). wink


to live is to die

Offline

#5 2006-12-14 17:17:35

paem
Member
Registered: 2006-10-09
Posts: 14

Re: open remote app via ssh [SOLVED]

export XAUTHORITY=$HOME/.Xauthority
export DISPLAY=:0.0
opera

I have vague understanding of how it works but executing it under console opens up opera in my X session.

Offline

#6 2006-12-14 17:21:06

hugin
Member
Registered: 2006-05-19
Posts: 93

Re: open remote app via ssh [SOLVED]

I believe ssh has a '-X' option, that will take care of forwarding graphics to your local machine.  This is quite slow, fyi.  I was doing it between buildings on my campus so that I could play frozen-bubble while I was TAing a CS101 lab.  YMMV on that.


/swogs


Open Toes; Open Mind; Open Source.

Offline

#7 2006-12-14 17:26:13

metzen
Member
From: New York City
Registered: 2004-08-27
Posts: 14

Re: open remote app via ssh [SOLVED]

If you don't want to mess around with screen, there is another option to accomplish this.

Use the command 'nohup'

nohup - run a command immune to hangups, with output to a non-tty

Basically, this allows you to start a program that will not be terminated when you disconnect from the ssh session (the program will be sent a SIGHUP signal when you disconnect, which would normally cause the program to exit if you were not using 'nohup')

So for example, you could run

# DISPLAY=:0 nohup bittorrent > torrent.log

disconnect from the ssh session, and the bittorrent instance would still be waiting for you on your desktop when you got home.

Offline

#8 2006-12-14 22:44:45

vasdee
Member
Registered: 2006-07-15
Posts: 55

Re: open remote app via ssh [SOLVED]

thanks for the replies people. big_smile

@Romashka

I suppose you want to run GUI program and see it via ssh on your screen, right?

not quite. All i want to do is launch a program, Rufus in this case so that it is running on my home machine in my existing gnome session. The reason for that is if i find a torrent that i want urgently i can just ftp/sftp the torrent into the Rufus working directory (from work) and it will automatically start downloading.

@paem

export XAUTHORITY=$HOME/.Xauthority
export DISPLAY=:0.0
opera

Similar to my reply above, i want the app (Rufus) to be launched under my existing gnome session that i use at home - i don't want to see the program what-so-ever. I just want to know that it is running.

@metzen
nohup - that seems to be what i'm after. I'll test it out and let y'all know. Cheers

Offline

#9 2006-12-14 22:59:20

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: open remote app via ssh [SOLVED]

remote machine:

export DISPLAY="local.com.0:0"

local machine:

xhost +remote.com

run it:

ssh -X user@remote.com
app

make sure --no-listen tcp is not enabled on the local machine otherwise the socket will be closed.

Offline

#10 2006-12-14 23:30:38

paem
Member
Registered: 2006-10-09
Posts: 14

Re: open remote app via ssh [SOLVED]

@paem

export XAUTHORITY=$HOME/.Xauthority
export DISPLAY=:0.0
opera

Similar to my reply above, i want the app (Rufus) to be launched under my existing gnome session that i use at home - i don't want to see the program what-so-ever. I just want to know that it is running.

And that's exactly what mine and metzen's replies aim to achieve. I tested it. I booted up old celeron with floppy(it doesn't even have X), logged in to my main box, executed what I posted earlier and I see opera showing up on monitor I'm looking at right now.

Of course, like metzen and ralvez said you need to make sure it won't stop when you log out. Besides screen and nohup you could use zsh - http://zsh.dotsrc.org/FAQ/zshfaq03.html -> 3.18.

Edit: Be sure to set XAUTHORITY, it won't work otherwise.

Offline

#11 2006-12-15 00:07:19

vasdee
Member
Registered: 2006-07-15
Posts: 55

Re: open remote app via ssh [SOLVED]

And that's exactly what mine and metzen's replies aim to achieve.

sorry, i misread - thanks for that. I tested it as well and it works like a charm.

Marking this as solved. smile

Offline

Board footer

Powered by FluxBB