I am trying to connect VPN during bootup of my new Ubuntu 18.04.4 LTS system. I am new to Linux. This is a new installation on an old Gateway laptop built for WindowsXP. It runs on 1GB RAM and an AMD Turion 64 (1.6Ghz) processor. I have spent 20-30 hours during the last week scouring tutorials and forums including AskUbuntu, attempting the simple sounding suggestions, re-reading, double-checking my work, etc. As far as I can tell I have tried every option described... without success. The three basic options I found are:
- Use Connection Manager
- Setup OpenVPN as a service
- Run a script at bootup
Option 1
I used the Nm-connection-manager to install the .ovpn file provided by ExpressVPN. Then I opened the settings of my LAN connection where I navigated to the General tab and checked the box to Automatically connect to VPN when using this connection
(I only have the one .ovpn loaded so it selected that option for me by default). Then I hit save and rebooted. VPN did not connect, but the LAN connection did just fine. I went back to the Connection Manager and saw that the little check box was now unchecked. Figuring I might have skipped saving the change, I again checked the box. Then I clicked SAVE with all my focus and intention. Reboot. Same story: No VPN and box is unchecked.
Option 2: Here are the steps I took to run VPN as a service
A. Installed OpenVPN.
B. Downloaded the appropriate .ovpn configuration file from my VPN provider (ExpressVPN) and copied it to /etc/openvpn/openvpn.conf.
C. Created auth.txt in the same folder, and put my username on the first line and password on the second line.
D. Added ¨auth.txt¨ on the last line of openvpn.conf at the end of the last line which says ¨auth-user-pass¨
E. Ran $ update-rc.d openvpn default
Result: Does not connect at bootup
Option 3: Steps I took to run a script during bootup:
A. Create a text file in /etc/init.d called script.sh containing:
#!/bin/bash
expressvpn connect
B. Run $ chmod 755
C. Run $ sudo update-rc.d script.sh defaults
Note: $ expressvpn connect
is what I currently use to successfully connect to my VPN server. I currently do this every time I boot the computer.
Result: I see that script.sh shows up as bright green alongside the other contents of init.d, but the VPN does not connect during bootup.
Overall conclusion: I am not confident that any scripts in /etc/init.d are being run at bootup. I tried running other scripts at bootup without success.
If you have read all of this you may be some sort of saint. I would be grateful for any suggestions.
Now that it's clarified, I have found a couple of other people on the site asking for a similar thing, but unfortunately all the questions are old and don't have accepted answers. Such as https://askubuntu.com/q/160048/243321 https://askubuntu.com/q/47048/243321 https://askubuntu.com/q/26793/243321
– Organic Marble May 07 '20 at 22:02