Linux 开机自动启动VPN客户端

vi /etc/systemd/system/[email protected]

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

相关推荐
Java致死1 小时前
设计模式Java
java·开发语言·设计模式
源码方舟1 小时前
SpringBoot + Shiro + JWT 实现认证与授权完整方案实现
java·spring boot·后端
持之以恒的天秤1 小时前
线程同步学习
linux·学习
2401_cf4 小时前
为什么hadoop不用Java的序列化?
java·hadoop·eclipse
帮帮志4 小时前
idea整合maven环境配置
java·maven·intellij-idea
LuckyTHP5 小时前
java 使用zxing生成条形码(可自定义文字位置、边框样式)
java·开发语言·python
厦门辰迈智慧科技有限公司5 小时前
城市排水管网流量监测系统解决方案
运维·服务器
qq_339282236 小时前
centos中libc.so.6No such file的解决方式
linux·运维·centos
leoufung6 小时前
ECPF 简介
linux·网络·kernel
在肯德基吃麻辣烫7 小时前
Netdata在Ubuntu环境下的安装与配置:构建实时系统监控与性能分析平台
linux·运维·ubuntu