You are not logged in.
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?
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
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
screen eh? looks interestng, thanks
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
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).
to live is to die
Offline
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
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
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
thanks for the replies people.
@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
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
@paem
export XAUTHORITY=$HOME/.Xauthority
export DISPLAY=:0.0
operaSimilar 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
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.
Offline