I have a program that runs on Ubuntu (14.04) whether I am in the terminal or not. This program relies on a vpn connection, for which I am using vpnc (cisco).

I have added vpnc to my reboot and start up processes, and my program works fine when I reboot (and soon thereafter log in to the terminal). But when I exit the terminal, I lose the vpn connection and the program throws an exception.

Can anyone help me figure out how to keep the vpn connection running even after I log out of the terminal?


You need to start vpnc using nohup. See this question.

For example to start command and to redirect its output to command.log use:

nohup command > command.log &

If you want to see the output use:

tail -f command.log
  • @user3079064 Thanks for the help, but for some reason this solution is not working with vpnc. The vpn keeps going down as soon as I exit the terminal. – user3079064 May 29 '14 at 17:35
  • have you tried nohup /usr/sbin/vpnc config.conf &? – sergej May 29 '14 at 17:45
  • Thank you for the follow-up. I am using sudo nohup vpnc & (and my config file is in a place that vpnc regularly checks). sudo vpnc works fine whenever I am logged into putty (even if I log back in later) but never when I am outside putty. – user3079064 May 29 '14 at 18:07
  • What about nohup sudo vpnc &? – sergej May 29 '14 at 19:03
  • Thanks again for the guidance, but that also produces the same result. – user3079064 May 29 '14 at 19:15

Try with Byobu:

Byobu is a light, powerful, text-based window manager based on GNU Screen . Using Byobu, you can quickly create and move between different windows over a single SSH connection or TTY terminal, monitor dozens of important statistics about your system, detach and reattach to sessions later while your programs continue to run in the background.

Just open byobu


In this new terminal start vpnc or what you need

press F6 to detach from this session

If you need this session you just need to run byobu again with


This session will "survive" your logout :)

For more shortcuts see the link in the first line...


Don't forget that if you want this session to stay active you must leave the session with F6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.