OpenVPN as Daemon with OVPN File?

Probably an obvious question but one that I’ve yet to find an answer for: is it possible to run the HTB OpenVPN connection in the background?
I’ve tried adding ‘daemon’ to the .ovpn file and running the connection with ‘–daemon’ but neither works (connection isn’t made)

Using the latest version of Kali Linux

I might have misunderstood, but doesnt & at the end of the command background it?

I tend to run it in its own tab and then just background the tab though.

You can launch the connection like this:

openvpn technicalBitch.ovpn > /dev/null 2>&1
CTRL + Z
bg
disown -h

Your VPN will still UP all the time even after shutting down the shell.

if you using systemd yes and actually openvpn clients SHOULD run using systemd. example: system start openvpn-client@htb htb is the config in /etc/openvpn/clients/htb.conf then you can run that as a user systemd will ask for sudo password. OpenVPN - ArchWiki (scroll down to “Starting OpenVPN”) I get the junks when I see people doing openvpn name.ovpn this is ok for testing… but as a systems engineer is BAD way of doing it. to automatize the connection to openvpn just systemctl enable openvpn-client@htb note this is for arch GNU/Linux and Blackarch but works similary for all GNU/Linux systems.

::facepalm::
Can’t believe I forgot the basic backgrounding command, thanks choupit0 and TazWake for the reminder.

@sparkla said:
You can do
command &>/dev/null

instead of
…2>&1…

it’s easier to remember. I made myself some litte scripts with a few parameters to toggle HTB and real VPN, the script will also output my new IP and now with the release area it’s much easier.

Mine goes like this:
htb-vpn
Or
htb-vpn release
Or
htb-vpn off

I’d be interested in seeing those scripts, if that’s okay.

@rek2 said:
I get the junks when I see people doing openvpn name.ovpn this is ok for testing… but as a systems engineer is BAD way of doing it.

I’ve not been a sysadmin for Linux systems; for future reference, why is this a bad way of doing it?

to automatize the connection to openvpn just systemctl enable openvpn-client@htb note this is for arch GNU/Linux and Blackarch but works similary for all GNU/Linux systems.

Debian variants also?

UPDATE: No disown on kali