Keep Remote App Running after ssh logout
I've trying different things to get around this problem without any luck. I have a Java-based application running on a remote server, which I connect to via SSH. After starting the application, it will die as soon as I logout. I've tried to nohup the java command. No dice. Does anyone have any suggestions or possible solutions? Disclaimer: The information contained in this communication is confidential and only for the use of the intended addressee(s). If you have received this communication in error, any disclosure or use of such information is strictly prohibited. Please notify the sender immediately and destroy all copies. Thank you.
On Tue, 8 Feb 2005 Andrew_Wrobel@PepBoys.com wrote:
After starting the application, it will die as soon as I logout. I've tried to nohup the java command. No dice.
Does anyone have any suggestions or possible solutions?
what happens if you make it an 'at' job? use 'at now'
Can't....at is not installed ( and no it can't be installed either ) To: Andrew_Wrobel@PepBoys.com cc: suse-security@suse.com Fax to: Subject: Re: [suse-security] Keep Remote App Running after ssh logout On Tue, 8 Feb 2005 Andrew_Wrobel@PepBoys.com wrote:
After starting the application, it will die as soon as I logout.
I've tried to nohup the java command. No dice.
Does anyone have any suggestions or possible solutions?
what happens if you make it an 'at' job? use 'at now' Disclaimer: The information contained in this communication is confidential and only for the use of the intended addressee(s). If you have received this communication in error, any disclosure or use of such information is strictly prohibited. Please notify the sender immediately and destroy all copies. Thank you.
Andrew, On Tuesday 08 February 2005 13:36, Andrew_Wrobel@PepBoys.com wrote:
I've trying different things to get around this problem without any luck.
I have a Java-based application running on a remote server, which I connect to via SSH.
After starting the application, it will die as soon as I logout. I've tried to nohup the java command. No dice.
Does anyone have any suggestions or possible solutions?
If you use BASH, you could try the "disown" command with the "-h" option. The "help" text for this built-in suggests it might help: % help disown disown: disown [-h] [-ar] [jobspec ...] By default, removes each JOBSPEC argument from the table of active jobs. If the -h option is given, the job is not removed from the table, but is marked so that SIGHUP is not sent to the job if the shell receives a SIGHUP. The -a option, when JOBSPEC is not supplied, means to remove all jobs from the job table; the -r option means to remove only running jobs. Randall Schulz
Andrew_Wrobel@PepBoys.com wrote:
I've trying different things to get around this problem without any luck.
I have a Java-based application running on a remote server, which I connect to via SSH.
After starting the application, it will die as soon as I logout. I've tried to nohup the java command. No dice.
Not surprising. nohup generally only works for console-based apps.
Does anyone have any suggestions or possible solutions?
What does that have to do with security ? Use VNC over SSH (vncserver -localhost :1) Rainer -- =================================================== ~ Rainer Duffner - rainer@ultra-secure.de ~ ~ Freising - Munich - Germany ~ ~ Unix - Linux - BSD - OpenSource - Security ~ ~ http://www.ultra-secure.de/~rainer/pubkey.pgp ~ ===================================================
On Tue February 8 2005 3:53 pm, Rainer Duffner wrote:
Andrew_Wrobel@PepBoys.com wrote:
I've trying different things to get around this problem without any luck.
I have a Java-based application running on a remote server, which I connect to via SSH.
After starting the application, it will die as soon as I logout. I've tried to nohup the java command. No dice.
If I'm understanding things correctly, the basic problem is that the ssh session creates a "tunnel" through which your X apps (including your graphical Java app) is displayed. When the ssh session goes away, so does the tunnel, and, poof, your remote X session as well. Sorry. -Nick -- <<< Why, oh, why, didn't I take the blue pill? >>> /`-_ Nick LeRoy The Condor Project { }/ http://www.cs.wisc.edu/~nleroy http://www.cs.wisc.edu/condor \ / nick.leroy@linuxmail.org The University of Wisconsin |_*_| 608-265-5761 Department of Computer Sciences
In that case what Rainer Duffner said is your best bet. Start a VNC server running on the REMOTE machine (i.e. vncserver :1 -depth 24) and tunnel that port from your local server to the remote machine. Then use vncviewer to access the remote X desktop. This way your Java app runs in a persistant environment. You can leave your app running and reconnect to it whenever you want. Think of it as the "screen" program for X Windows. To forward the port you'd change your ssh login command to something like ssh -L 5901:localhost:5901 <destination hostname> That's if you start a vncserver as desktop :1. The port number would be 5902 if it was desktop :2 etc. The only problem is that now ANYONE can try to connect to that remote vncserver(!) session (unless firewalled). So you probably want to password it and/or add a firewall rule to stop all external connections to that port 5902. Blocking external connections to that port wont stop your SSH tunneled ones. :) Alternatively you can do some sort of SSH suspend or backgrounding operation but I haven't tried that myself. Cheers
-----Original Message----- From: Nick LeRoy [mailto:nick.leroy@linuxmail.org] Sent: Wednesday, 9 February 2005 11:00 a.m. To: suse-security@suse.com Subject: Re: [suse-security] Keep Remote App Running after ssh logout
On Tue February 8 2005 3:53 pm, Rainer Duffner wrote:
Andrew_Wrobel@PepBoys.com wrote:
I've trying different things to get around this problem without any luck.
I have a Java-based application running on a remote server, which I connect to via SSH.
After starting the application, it will die as soon as I logout. I've tried to nohup the java command. No dice.
If I'm understanding things correctly, the basic problem is that the ssh session creates a "tunnel" through which your X apps (including your graphical Java app) is displayed. When the ssh session goes away, so does the tunnel, and, poof, your remote X session as well.
Sorry.
-Nick
-- <<< Why, oh, why, didn't I take the blue pill? >>> /`-_ Nick LeRoy The Condor Project { }/ http://www.cs.wisc.edu/~nleroy http://www.cs.wisc.edu/condor \ / nick.leroy@linuxmail.org The University of Wisconsin |_*_| 608-265-5761 Department of Computer Sciences
-- Check the headers for your unsubscription address For additional commands, e-mail: suse-security-help@suse.com Security-related bug reports go to security@suse.de, not here
Mike Tierney wrote:
In that case what Rainer Duffner said is your best bet.
Start a VNC server running on the REMOTE machine (i.e. vncserver :1 -depth 24) and tunnel that port from your local server to the remote machine. Then use vncviewer to access the remote X desktop. This way your Java app runs in a persistant environment. You can leave your app running and reconnect to it whenever you want. Think of it as the "screen" program for X Windows.
To forward the port you'd change your ssh login command to something like
ssh -L 5901:localhost:5901 <destination hostname>
That's if you start a vncserver as desktop :1. The port number would be 5902 if it was desktop :2 etc.
The only problem is that now ANYONE can try to connect to that remote vncserver(!) session (unless firewalled). So you probably want to password it and/or add a firewall rule to stop all external connections to that port 5902. Blocking external connections to that port wont stop your SSH tunneled ones. :)
That's why you let vnc listen to localhost. Then, you can do ssh target -L 5901:127.0.0.1:5901 . The vnc-documentation/website contains more information (and some drawings) about this. cheers, Rainer -- =================================================== ~ Rainer Duffner - rainer@ultra-secure.de ~ ~ Freising - Munich - Germany ~ ~ Unix - Linux - BSD - OpenSource - Security ~ ~ http://www.ultra-secure.de/~rainer/pubkey.pgp ~ ===================================================
Ah! :) yes I see what "vncserver -localhost" does now. That very handy piece of information missing from the vncserver manpage, but maybe I have an older version installed :( Thanks for pointing that out!
-----Original Message----- From: Rainer Duffner [mailto:rainer@ultra-secure.de] Sent: Wednesday, 9 February 2005 7:24 p.m. To: suse-security@suse.com Subject: Re: [suse-security] Keep Remote App Running after ssh logout
Mike Tierney wrote:
In that case what Rainer Duffner said is your best bet.
Start a VNC server running on the REMOTE machine (i.e. vncserver :1 - depth 24) and tunnel that port from your local server to the remote machine. Then use vncviewer to access the remote X desktop. This way your Java app runs in a persistant environment. You can leave your app running and reconnect to it whenever you want. Think of it as the "screen" program for X Windows.
To forward the port you'd change your ssh login command to something like
ssh -L 5901:localhost:5901 <destination hostname>
That's if you start a vncserver as desktop :1. The port number would be 5902 if it was desktop :2 etc.
The only problem is that now ANYONE can try to connect to that remote vncserver(!) session (unless firewalled). So you probably want to password it and/or add a firewall rule to stop all external connections to that port 5902. Blocking external connections to that port wont stop your SSH tunneled ones. :)
That's why you let vnc listen to localhost.
Then, you can do ssh target -L 5901:127.0.0.1:5901 .
The vnc-documentation/website contains more information (and some drawings) about this.
cheers, Rainer
-- =================================================== ~ Rainer Duffner - rainer@ultra-secure.de ~ ~ Freising - Munich - Germany ~ ~ Unix - Linux - BSD - OpenSource - Security ~ ~ http://www.ultra-secure.de/~rainer/pubkey.pgp ~ ===================================================
-- Check the headers for your unsubscription address For additional commands, e-mail: suse-security-help@suse.com Security-related bug reports go to security@suse.de, not here
Yeah, that's pretty much the dilemma I have found that I can do this ( but it's in no way a solution ) ssh into the remote server as user alpha su to user beta start up the application exit out of user beta check that the java application is still running, which it is. logout of the remote server ssh back into the remote server as user alpha java application IS still running I'm trying differnet ways of using the disown sub-shell command. Not having any luck. Part of the problem is that the rc script does a su to run the java application as a non-root user. Do I need to use the disown on the initial calling script or all the java processes? Please respond to nick.leroy@linuxmail.org To: suse-security@suse.com cc: Fax to: Subject: Re: [suse-security] Keep Remote App Running after ssh logout On Tue February 8 2005 3:53 pm, Rainer Duffner wrote:
Andrew_Wrobel@PepBoys.com wrote:
I've trying different things to get around this problem without any luck.
I have a Java-based application running on a remote server, which I connect to via SSH.
After starting the application, it will die as soon as I logout. I've tried to nohup the java command. No dice.
If I'm understanding things correctly, the basic problem is that the ssh session creates a "tunnel" through which your X apps (including your graphical Java app) is displayed. When the ssh session goes away, so does the tunnel, and, poof, your remote X session as well. Sorry. -Nick -- <<< Why, oh, why, didn't I take the blue pill? >>> /`-_ Nick LeRoy The Condor Project { }/ http://www.cs.wisc.edu/~nleroy http://www.cs.wisc.edu/condor \ / nick.leroy@linuxmail.org The University of Wisconsin |_*_| 608-265-5761 Department of Computer Sciences -- Check the headers for your unsubscription address For additional commands, e-mail: suse-security-help@suse.com Security-related bug reports go to security@suse.de, not here Disclaimer: The information contained in this communication is confidential and only for the use of the intended addressee(s). If you have received this communication in error, any disclosure or use of such information is strictly prohibited. Please notify the sender immediately and destroy all copies. Thank you.
On Tue, 8 Feb 2005 16:36:14 -0500, Andrew_Wrobel@pepboys.com <Andrew_Wrobel@pepboys.com> wrote:
I've trying different things to get around this problem without any luck. I have a Java-based application running on a remote server, which I connect to via SSH. After starting the application, it will die as soon as I logout. I've tried to nohup the java command. No dice. Does anyone have any suggestions or possible solutions?
What about installing screen? is my preferred way to keep running text applicaitons, you can even recover the consone betweens logons.
participants (7)
-
Andrew_Wrobel@PepBoys.com
-
Dana Hudes
-
Gustavo Muslera
-
Mike Tierney
-
Nick LeRoy
-
Rainer Duffner
-
Randall R Schulz