vi /etc/systemd/system/openvpn@.service
[Unit]
Description=OpenVPN connection to %I
After=network.target network-online.target
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/sbin/openvpn --config /etc/openvpn/client/%i.ovpn
Restart=on-failure
KillMode=process
[Install]
WantedBy=multi-user.target
==============
systemctl daemon-reload
systemctl enable openvpn@MaAnShanClient
sudo systemctl status openvpn@MaAnShanClient
==============
vi /etc/openvpn/client/MaAnShanClient.ovpn
auth-user-pass /etc/openvpn/client/static-auth-MaAnShanClient
vi /etc/openvpn/client/static-auth-MaAnShanClient
里面内容 两行,用户名 口令
sudo chmod 600 /etc/openvpn/client/static-auth-MaAnShanClient
sudo chown root:root /etc/openvpn/client/static-auth-MaAnShanClient
systemctl restart openvpn@MaAnShanClient