Jump to content
Not connected, Your IP: 18.118.93.61
uatavpn

linux - how to start openvpn on boot and auto-log-on?

Recommended Posts

i've found a number of guides regarding the subject, but none that seem to put it all together in a complete package

 

i'm new to linux (mint 17.2, KDE) and i could use some help...

 

i don't want to use the Eddie client (the deb package one depends on mono, which i have removed, and the portable one does not work well (extremely sluggish to respond to mouse input))

 

so what i want to do in the end is log-on to a VPN server at boot, completely transparently

 

i understand the config files need to be created in advanced mode with the keys/certs separate, but i'm not sure where they should (ideally) be located - /etc/openvpn ?

 

i also assume i do not need the executables from the config generator page ???

 

and i don't know the best way to start openvpn - should i use the GUI Autostart util in KDE? /init.d ? other?

Share this post


Link to post

Can't help, I'm new to Mint 17.3 and have recently reninstalled the root cos I made such a mess of things . However, I find Eddie a breeze to use on Linux, lightening fast and just perfect.

 

What is it with mono that is so bad?

Share this post


Link to post

On a VPS I have I use crontab (much less hassle, I think, than dealing with "/etc/init..." scripts) to start OpenVPN and rtorrent at boot.:

 

http://linux.die.net/man/1/crontab

 

You type this to edit your crontab:

crontab -e
I added a line like this:

 

@reboot /bin/bash -l $HOME/bin/at_reboot_run
In the bin folder in my home folder I have these scripts:

 

Here is that script:

$ cat $HOME/bin/at_reboot_run
#!/bin/bash
sudo rm /tmp/openvpn_run_log
$HOME/bin/openvpn_run
rm -f ~/rtorrent_run/session/rtorrent.lock
rm /tmp/rtorrent_run_log
echo pausing while openvpn starts
sleep 6
$HOME/bin/rtorrent_run
You can drop the rtorrent stuff. I just left it for completeness, Here is what is in the openvpn_run script:

~$ cat $HOME/bin/openvpn_run
#!/bin/bash
screen -fa -dmS openvpn $HOME/bin/openvpn_run_log
And here is what is in the script called from that one:

$ cat $HOME/bin/openvpn_run_log
#!/bin/bash
pushd $HOME/openvpn_run > /dev/null
f=`echo *.ovpn`
sudo openvpn $f | tee /tmp/openvpn_run_log
popd > /dev/null

The folder "$HOME/openvpn_run" contains a single file ending in ".ovpn" (and the necessary key files, of course). When I want to change servers, I replace it.

 

Here is the user manual for screen:

 

https://www.gnu.org/software/screen/manual/screen.html#Invoking-Screen

 

Two commands that are useful here are:

screen -ls
and

screen -r openvpn
You also want to know about the key sequence to suspend again after doing "screen -r openvpn". Use "Ctrl-a d" (or "C-a d" using the notation in the manual) for this.

 

You can look at the screen man page too, of course.

 

To stop openvpn after doing "screen -r openvpn", use "Ctrl-C".

 

===

 

NOTE: I edited the scripts a bit. Hopefully that did not break them. They are just meant as examples anyway.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Security Check
    Play CAPTCHA Audio
    Refresh Image

×
×
  • Create New...