How to autostart OpenVPN (client) on Ubuntu 12.04 CLI?
I have an *.ovpn file that works if I type in: sudo openvpn filename.ovpn
.
Now I would like to start up OpenVPN when I boot the computer. It's a headless version of Ubuntu 12.04 64-bit if that matters.
I copied filename.ovpn to /etc/openvpn
, but it's not starting, even if I run: service openvpn start
.
How can I do this?
linux ubuntu openvpn
add a comment |
I have an *.ovpn file that works if I type in: sudo openvpn filename.ovpn
.
Now I would like to start up OpenVPN when I boot the computer. It's a headless version of Ubuntu 12.04 64-bit if that matters.
I copied filename.ovpn to /etc/openvpn
, but it's not starting, even if I run: service openvpn start
.
How can I do this?
linux ubuntu openvpn
see: upstart.ubuntu.com/getting-started.html
– mbx
Dec 17 '12 at 8:12
Have you tried naming your file client.conf?
– user2313067
Feb 18 '14 at 8:52
add a comment |
I have an *.ovpn file that works if I type in: sudo openvpn filename.ovpn
.
Now I would like to start up OpenVPN when I boot the computer. It's a headless version of Ubuntu 12.04 64-bit if that matters.
I copied filename.ovpn to /etc/openvpn
, but it's not starting, even if I run: service openvpn start
.
How can I do this?
linux ubuntu openvpn
I have an *.ovpn file that works if I type in: sudo openvpn filename.ovpn
.
Now I would like to start up OpenVPN when I boot the computer. It's a headless version of Ubuntu 12.04 64-bit if that matters.
I copied filename.ovpn to /etc/openvpn
, but it's not starting, even if I run: service openvpn start
.
How can I do this?
linux ubuntu openvpn
linux ubuntu openvpn
edited Nov 13 '13 at 10:59
karel
9,18793138
9,18793138
asked Dec 17 '12 at 3:43
waspinator
13115
13115
see: upstart.ubuntu.com/getting-started.html
– mbx
Dec 17 '12 at 8:12
Have you tried naming your file client.conf?
– user2313067
Feb 18 '14 at 8:52
add a comment |
see: upstart.ubuntu.com/getting-started.html
– mbx
Dec 17 '12 at 8:12
Have you tried naming your file client.conf?
– user2313067
Feb 18 '14 at 8:52
see: upstart.ubuntu.com/getting-started.html
– mbx
Dec 17 '12 at 8:12
see: upstart.ubuntu.com/getting-started.html
– mbx
Dec 17 '12 at 8:12
Have you tried naming your file client.conf?
– user2313067
Feb 18 '14 at 8:52
Have you tried naming your file client.conf?
– user2313067
Feb 18 '14 at 8:52
add a comment |
2 Answers
2
active
oldest
votes
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]
respawn
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
add a comment |
Ubuntu is derived from Debian. Debian has a manual page about this: https://wiki.debian.org/OpenVPN#Auto-start
They both have a README file installed with the openvpn package. That file says, how and where to place configs for autostart to work, but it has instructions for old init system and is misleading for systems with systemd.
Configs should be put into /etc/openvpn/filename.conf, not .ovpn.
On the new systems please make use of systemd cloned service. To enable (autostart) service with configuration /etc/openvpn/filename.conf do:
systemctl enable openvpn@filename.service
Then you work with newly created service as usual.
On the old Debian (pre-systemd) by default "openvpn" service tries to run them all. /etc/default/openvpn could be used to select which configurations to execute by default.
This applies equally to all "peer-to-peer", "client" and "server" openvpn deployment variants.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f520286%2fhow-to-autostart-openvpn-client-on-ubuntu-12-04-cli%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
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]
respawn
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
add a comment |
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]
respawn
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
add a comment |
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]
respawn
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
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]
respawn
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
answered Dec 17 '12 at 4:32
waspinator
13115
13115
add a comment |
add a comment |
Ubuntu is derived from Debian. Debian has a manual page about this: https://wiki.debian.org/OpenVPN#Auto-start
They both have a README file installed with the openvpn package. That file says, how and where to place configs for autostart to work, but it has instructions for old init system and is misleading for systems with systemd.
Configs should be put into /etc/openvpn/filename.conf, not .ovpn.
On the new systems please make use of systemd cloned service. To enable (autostart) service with configuration /etc/openvpn/filename.conf do:
systemctl enable openvpn@filename.service
Then you work with newly created service as usual.
On the old Debian (pre-systemd) by default "openvpn" service tries to run them all. /etc/default/openvpn could be used to select which configurations to execute by default.
This applies equally to all "peer-to-peer", "client" and "server" openvpn deployment variants.
add a comment |
Ubuntu is derived from Debian. Debian has a manual page about this: https://wiki.debian.org/OpenVPN#Auto-start
They both have a README file installed with the openvpn package. That file says, how and where to place configs for autostart to work, but it has instructions for old init system and is misleading for systems with systemd.
Configs should be put into /etc/openvpn/filename.conf, not .ovpn.
On the new systems please make use of systemd cloned service. To enable (autostart) service with configuration /etc/openvpn/filename.conf do:
systemctl enable openvpn@filename.service
Then you work with newly created service as usual.
On the old Debian (pre-systemd) by default "openvpn" service tries to run them all. /etc/default/openvpn could be used to select which configurations to execute by default.
This applies equally to all "peer-to-peer", "client" and "server" openvpn deployment variants.
add a comment |
Ubuntu is derived from Debian. Debian has a manual page about this: https://wiki.debian.org/OpenVPN#Auto-start
They both have a README file installed with the openvpn package. That file says, how and where to place configs for autostart to work, but it has instructions for old init system and is misleading for systems with systemd.
Configs should be put into /etc/openvpn/filename.conf, not .ovpn.
On the new systems please make use of systemd cloned service. To enable (autostart) service with configuration /etc/openvpn/filename.conf do:
systemctl enable openvpn@filename.service
Then you work with newly created service as usual.
On the old Debian (pre-systemd) by default "openvpn" service tries to run them all. /etc/default/openvpn could be used to select which configurations to execute by default.
This applies equally to all "peer-to-peer", "client" and "server" openvpn deployment variants.
Ubuntu is derived from Debian. Debian has a manual page about this: https://wiki.debian.org/OpenVPN#Auto-start
They both have a README file installed with the openvpn package. That file says, how and where to place configs for autostart to work, but it has instructions for old init system and is misleading for systems with systemd.
Configs should be put into /etc/openvpn/filename.conf, not .ovpn.
On the new systems please make use of systemd cloned service. To enable (autostart) service with configuration /etc/openvpn/filename.conf do:
systemctl enable openvpn@filename.service
Then you work with newly created service as usual.
On the old Debian (pre-systemd) by default "openvpn" service tries to run them all. /etc/default/openvpn could be used to select which configurations to execute by default.
This applies equally to all "peer-to-peer", "client" and "server" openvpn deployment variants.
edited Dec 27 '18 at 9:34
answered Dec 6 '15 at 6:29
Nikita Kipriyanov
30319
30319
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f520286%2fhow-to-autostart-openvpn-client-on-ubuntu-12-04-cli%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
see: upstart.ubuntu.com/getting-started.html
– mbx
Dec 17 '12 at 8:12
Have you tried naming your file client.conf?
– user2313067
Feb 18 '14 at 8:52