5 Ways to Keep Remote SSH Sessions and Processes Running After Disconnection

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Gunjit Khera

Currently a Computer Science student and a geek when it comes to Operating System and its concepts. Have 1+ years of experience in Linux and currently doing a research on its internals along with developing applications for Linux on python and C.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Receive Your Free Complimentary eBook NOW! -

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Introduction to Linux - A Hands on Guide

You may also like...

6 Responses

  1. L P says:

    The easiest way, if you know ahead of time, is to fork the ssh after authentication, with the ‘-f’ flag:

    $ ssh -f larry@10.0.2.2 ‘sleep 1; echo hi’
    Password:
    $ hi

    redirecting stdout & stderr is recommended, either on the local side or remote.

    • Gunjit Khera says:

      Hi! thanks for your suggestion, this is also a good way for running ssh connection if you want to execute a particular command on remote host.
      Stay Connected.. :-)

  2. Hil Palmer says:

    Another way I run background jobs and don’t want it to die when I exit is to send it to at.

    Example: echo “/tmp/script_name.sh” | at now

  3. Paul says:

    Good article, thanks=)

    P.S. In tmux reattaching section comes tmux detach again. I think you mean attach =)

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 150K+ Linux Users
  1. 100,756
  2. 5,113
  3. 36,418

Enter your email to get latest Linux Howto's