Bash Script: Connect To Free VPN ProtonVPN With OpenVPN Configs

ProtonVPN allows to use Free VPN servers in Netherlands, USA, Japan. You may use official application for Linux, Android. But for fine configuring and connect just in one click need to connect with own script using OpenVPN configs by ProtonVPN. Here it is my own bash script for connect to the best protonvpn server in one click.

0. Prerequisits

Intall tor, torsocks, openvpn, resolvconf, jq

apt-get install tor torsocks openvpn resolvconf jq

Resolvconf is for protonvpn updates /etc/resolv.conf when connects via openvpn.

Jq is for parse servers list file.

Tor, torsocks are for download servers list via tor (because protonvpn domain can be blocked in some countries, in Russia it was for some time).


1. Create account if you still have not Account on this site is the same as on Sometimes it requires verification by SMS.

2. Choose free plan on ptotonvpn and create VPN account

After that you will be able to get OpenVPN login and password here:

Create file with two lines: logins and password and put it to /home/user/configs/protonvpn

3. Download OpenVPN config files

On the download page find OpenVPN configs and download all free servers configs (or just that you will use):

And put them to /root/vpn/protonvpn/


# ls /root/vpn/protonvpn

4. Download bash script and give right to execute

Here it is my bash script:

Put it to /usr/scripts/op for example

wget -O /usr/scripts/op

chmod +x /usr/scripts/op

vim /usr/scripts/op

And also check its config: folder with ovpn files and path to login/pass file.


5. Add alias, add sudo rights and run

For run as usual user add to /etc/sudoers (if your distribution works on SysVinit):

%netdev    ALL=(root) NOPASSWD:   /usr/sbin/service, /etc/init.d/tor, /usr/sbin/openvpn, /usr/scripts/op, /usr/scripts/

Where %netdev is group of usual user. You may use %sudo instead if your usual user belongs to sudo group.

Add alias to ~/.bash_aliases

alias op='sudo /usr/scripts/op'



And this will download list of servers, choose the less loaded and will connect to it.

For help use:

op -h


For issues or questions use Stackoverflow or reddit.



  1. Official ProtonVPN site
  2. My bash script
  3. ProtonVPN servers list