Traffic wroteActually, setting openvpn as user and group in the unit file fails immediately as user:openvpn cannot even read my (root only) PKI. But at least it proves the the unit file assigns the requested user&group immediately.
Well, I've added in the OpenVPN unit file
User and
Group options:
[shau-kote@myvps ~]$ cat /etc/systemd/system/multi-user.target.wants/openvpn@server.service
[Unit]
Description=OpenVPN Robust And Highly Flexible Tunneling Application On %I
After=network.target
[Service]
PrivateTmp=true
Type=forking
PIDFile=/var/run/openvpn/%i.pid
ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf
User=openvpn
Group=openvpn
[Install]
WantedBy=multi-user.target
[shau-kote@myvps ~]$
and have tried to start it. As expected, it has failed:
[shau-kote@myvps ~]$ sudo systemctl start openvpn@server.service
Job for openvpn@server.service failed because the control process exited with error code. See "systemctl status openvpn@server.service" and "journalctl -xe" for details.
[shau-kote@myvps ~]$ sudo systemctl status openvpn@server.service
● openvpn@server.service - OpenVPN Robust And Highly Flexible Tunneling Application On myvps/tcp
Loaded: loaded (/usr/lib/systemd/system/openvpn@.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2016-01-14 23:24:56 UTC; 5s ago
Process: 1974 ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf (code=exited, status=1/FAILURE)
Main PID: 1885 (code=exited, status=1/FAILURE)
Jan 14 23:24:56 myvps systemd[1]: Starting OpenVPN Robust And Highly Flexible Tunneling Application On myvps/tcp...
Jan 14 23:24:56 myvps openvpn[1974]: Options error: In [CMD-LINE]:1: Error opening configuration file: server.conf
Jan 14 23:24:56 myvps openvpn[1974]: Use --help for more information.
Jan 14 23:24:56 myvps systemd[1]: openvpn@server.service: Control process exited, code=exited status=1
Jan 14 23:24:56 myvps systemd[1]: Failed to start OpenVPN Robust And Highly Flexible Tunneling Application On myvps/tcp.
Jan 14 23:24:56 myvps systemd[1]: openvpn@server.service: Unit entered failed state.
Jan 14 23:24:56 myvps systemd[1]: openvpn@server.service: Failed with result 'exit-code'.
[shau-kote@myvps ~]$