Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have an *.ovpn file that works if I type in

sudo openvpn client.ovpn

Now I would like to start up openvpn when I boot the computer. It's a headless version of ubuntu if that matters. 12.04 64bit.

How can I do this?


share|improve this question

2 Answers 2

up vote 2 down vote accepted

It would be nice to have a un hacker way of doing it, but this will have to do for now.

1) Create file myopenvpn in /etc/init.d/

nano /etc/init.d/myopenvpn

2) Insert into myopenvpn and save:

# OpenVPN autostart on boot script

start on runlevel [2345]
stop on runlevel [!2345]


exec /usr/sbin/openvpn --status /var/run/openvpn.client.status 10 --cd /etc/openvpn --config /etc/openvpn/client.conf --syslog openvpn

SOURCE: http://www.hackerway.ch/2012/12/11/how-to-auto-start-openvpn-client-in-debian-6-and-ubuntu-12-04/#comment-79

share|improve this answer

The openvpn package comes with an init script /etc/init.d/openvpn. This script automatically sets up connection for every .conf (mind the extension) file in /etc/openvpn.

Found this based on information here: https://openvpn.net/index.php/open-source/documentation/howto.html#startup

If you install OpenVPN via an RPM or DEB package on Linux, the installer will set up an initscript. When executed, the initscript will scan for .conf configuration files in /etc/openvpn, and if found, will start up a separate OpenVPN daemon for each file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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