Skip to main content

Manual Connection and Port Forwarding Scripts - Knowledgebase / Technical / Application Settings and Features / Application & Features - PIA Support Portal

Manual Connection and Port Forwarding Scripts

Authors list

Manual Connection and Port Forwarding Scripts 

GETTING READY

For users who cannot use the PIA application, we have provided the following scripts for manual configurations, to allow protection using WireGuard or OpenVPN connections, and access to the Port Forwarding feature on the new network. 

For any system that is compatible with the PIA software, we suggest using the PIA software instead of these scripts. 

Manual Connections Beginners Video 


DEPENDENCIES 

In order for the scripts to work, you will need the following packages: 

  • curl 

  • jq 

  • (only for WireGuard) wg-quick and wireguard kernel module 

  • (only for OpenVPN) openvpn 

The process for retrieving and installing those packages will vary depending upon your operating system, and must be done at your own effort and discretion.  

DOWNLOAD THE SCRIPTS 

First, retrieve the necessary files. These compressed folders contain the scripts and security certificate required to establish a connection: 

https://github.com/pia-foss/manual-connections/releases/tag/v2.0.0

Once you have downloaded the compressed folder, decompress it for use. 

 

USING THE SCRIPTS 

Each of the bash scripts (shown as “SH File” in the image above) performs a specific task or set of tasks, and when passed the necessary variables on call, can be used independently. 

The ‘run_setup.sh’ script operates differently, as it does not receive variable input on call, but instead provides a set of prompts that receive input and process the other scripts in response to the input provided. The easiest way to utilize this provision is with the run_setup.sh script. 

To start, open a terminal interface and navigate to the folder containing the downloaded scripts, then run the following command :  

sudo ./run_setup.sh 

You will first be prompted for the sudo (system administrator) password for your system - that is your computer password, unrelated to your PIA account. 

You will then be asked for your PIA username, followed by your PIA *password.  

*Note: the password input will not show anything you type; input is still received, this is an intentional security provision. 

 

The following inquiries will be somewhat dependent upon your system setup, but you will then be prompted for input as to what kind of connection you want to establish. Note that the option designated with a capital letter will be the default input, which is assumed if no input, or unexpected input, is received. 

Once you have finished responding to the prompts of run_setup.sh your system will attempt to establish an OpenVPN or WireGuard connection. Any complications will notify you of what is wrong, such as the input of improper login credentials. 

MANAGING CONNECTIONS 

OpenVPN connections and Wireguard connections started with this script will run in the background. Both will provide instructions as to how you will disconnect when you are ready: 

For WireGuard connections, disconnecting requires running the terminal command : 

wg-quick down pia 

For OpenVPN connections, you will be provided with a customized command that includes the process ID associated with the connection. An example of the command to close OpenVPN connections is : 

sudo kill 1234 

If you are using the Port Forwarding feature, you must leave the script window open. Port forwarding will time out after 15 minutes or less if the script window is closed. The terminal output will provide the forwarded port you have been assigned, as well as when it will time-out. 

Note, if you are using Port Forwarding and close the terminal window, your VPN connection will still remain active until you run one of the aforementioned commands to explicitly close the connection.