根据ArchWiki 我添加了一个 systemctl 服务来将 SIGNUP 消息发送到 openvpn 进程以使其重新启动。
问题是,如果使用
sudo systemctl start openvpn-client@chenyichi
,这个过程可以正确启动,但使用sudo /usr/bin/pkill --signal SIGHUP --exact openvpn
后就出错了。
完整的日志信息在这里:
× [email protected] - OpenVPN tunnel for chenyichi
Loaded: loaded (/usr/lib/systemd/system/[email protected]; enabled; preset: disabled)
Active: failed (Result: exit-code) since Wed 2023-12-20 15:26:40 CST; 9min ago
Duration: 1min 51.529s
Docs: man:openvpn(8)
https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
https://community.openvpn.net/openvpn/wiki/HOWTO
Process: 38264 ExecStart=/usr/bin/openvpn --suppress-timestamps --nobind --config /etc/openvpn/client/chenyichi.conf (code=exited, status=1/FAILURE)
Main PID: 38264 (code=exited, status=1/FAILURE)
Status: "Initialization Sequence Completed"
CPU: 66ms
12月 20 15:26:40 trswnca-y7000p openvpn[38264]: net_route_v4_del: 192.168.1.0/24 via 10.8.0.93 dev [NULL] table 0 metric -1
12月 20 15:26:40 trswnca-y7000p openvpn[38264]: net_route_v4_del: 172.18.16.0/22 via 10.8.0.93 dev [NULL] table 0 metric -1
12月 20 15:26:40 trswnca-y7000p openvpn[38264]: net_route_v4_del: 10.8.0.1/32 via 10.8.0.93 dev [NULL] table 0 metric -1
12月 20 15:26:40 trswnca-y7000p openvpn[38264]: Closing TUN/TAP interface
12月 20 15:26:40 trswnca-y7000p openvpn[38264]: net_addr_ptp_v4_del: 10.8.0.94 dev tun0
12月 20 15:26:40 trswnca-y7000p openvpn[38264]: SIGHUP[hard,] received, process restarting
12月 20 15:26:40 trswnca-y7000p openvpn[38264]: Options error: In [CMD-LINE]:1: Error opening configuration file: /etc/openvpn/client/chenyichi.conf
12月 20 15:26:40 trswnca-y7000p openvpn[38264]: Use --help for more information.
12月 20 15:26:40 trswnca-y7000p systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
12月 20 15:26:40 trswnca-y7000p systemd[1]: [email protected]: Failed with result 'exit-code'.
这很奇怪,因为该文件应该由具有 root 权限的进程读取。我对此一无所知。有人可以帮忙吗?
特权在这里:
$ ls -l /etc/openvpn/client
total 16
-rw-r--r-- 1 root root 13257 12月20日 00:47 chenyichi.conf
向我的用户致敬并没有帮助,也没有。
尝试编写这个命令
service openvpn restart
然后再试一次
sudo openvpn file-name.ovpn