Is there a way to kill an ssh session without killing processes started inside it?

Novell Cool Solutions: Question & Answer

Posted: 13 Jan 2005

When using ssh to remote a desktop, sometimes you will want to start a process and then close the terminal window. The problem is that if you close it before the process is done, it will kill the process. Even if you back ground the process.
Is there a way to start a process via SSH and not have it die when the SSH connection is closed?

There are multiple ways of doing so:

  • use the -f option (ssh -f blah@blah.com)
  • use the -n option when running ssh in the background. e.g. "ssh -n shadows.cs.hut.fi emacs &" will start an emacs on shadows.cs.hut.fi, and the X11 connection will be automatically forwarded over an encrypted channel. The ssh program will be put in the background.
  • use "nohup" in front of the process. e.g. #nohup ssh blah@blah.com

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© Micro Focus