{"article":{"id":46565791890971,"url":"https://piavpnsupport.zendesk.com/api/v2/help_center/en-us/articles/46565791890971.json","html_url":"https://helpdesk.privateinternetaccess.com/hc/en-us/articles/46565791890971-Linux-Manual-Connection-Scripts","author_id":18738476706459,"comments_disabled":true,"draft":false,"promoted":false,"position":6,"vote_sum":-4,"vote_count":10,"section_id":46863862061723,"created_at":"2026-02-12T05:04:32Z","updated_at":"2026-08-03T12:39:48Z","name":"Linux - Manual Connection Scripts","title":"Linux - Manual Connection Scripts","source_locale":"en-us","locale":"en-us","outdated":false,"outdated_locales":[],"edited_at":"2026-08-03T12:39:48Z","user_segment_id":null,"permission_group_id":47853597986715,"content_tag_ids":[],"label_names":[],"body":"<p>If you cannot use the Private Internet Access (PIA) app, you can use PIA’s manual connection scripts to connect with WireGuard or OpenVPN. These scripts can also help you use the port forwarding feature.</p><p>For systems that support the PIA app, we recommend using the <a href=\"https://www.privateinternetaccess.com/pages/download\"><span class=\"wysiwyg-underline\">PIA app</span></a> instead of the manual connection scripts.</p><h2 id=\"h_01KZ3CYCEN5FHQZRY299D5FAV4\">Jump To:</h2><ul>\n<li data-list-item-id=\"e6e9823f7d9136f0bcb4443ffd81492e1\"><a href=\"#h_01KZ3CYCEZAWN6D2FH1VWR8W64\">Requirements</a></li>\n<li data-list-item-id=\"e14c27efa04fa20fda33db2874ac0428b\"><a href=\"#h_01KZ3CYCF5WHJJBATWXXYHN5RC\">Download the Scripts</a></li>\n<li data-list-item-id=\"e3e546ce7ab6ed49a6e96a03ddb02d581\"><a href=\"#h_01KZ3CYCFAX1KVN51133FDWGMR\">Use the Scripts</a></li>\n<li data-list-item-id=\"ef9935b496d9b63c3a99185933002a968\"><a href=\"#h_01KZ3CYCFJ51CANE8BDFF71HRQ\">Manage Connections</a></li>\n<li data-list-item-id=\"e5293c50b5ac2eb678226044ed77f865f\"><a href=\"#h_01KZ3CYCFRQ901X991QDSMSB10\">Use Port Forwarding</a></li>\n<li data-list-item-id=\"e4fdf26efb6b8414916ac4869984c770f\"><a href=\"#h_01KZ3CYCFVKH9YJ54MPC99V5NC\">Use One-Line Calls</a></li>\n</ul><h2 id=\"h_01KZ3CYCEZAWN6D2FH1VWR8W64\">Requirements</h2><p>For the scripts to work, you need the following packages:</p><ul>\n<li data-list-item-id=\"ecd6f1060ce8db8bab0dd4e35fea49cb6\">curl</li>\n<li data-list-item-id=\"e61eeac471f26be279bd4a1ed9b145ad6\">jq</li>\n<li data-list-item-id=\"ea9073f366853d68aa66c90b9efcaa982\">wireguard-tools (for WireGuard connections)</li>\n<li data-list-item-id=\"eb9ec7634b6c8684bf720a315fb0d8039\">openvpn (for OpenVPN connections)</li>\n</ul><p>The process for installing these packages varies by operating system and Linux distribution. You can check out online guides for your specific setup.</p><h2 id=\"h_01KZ3CYCF5WHJJBATWXXYHN5RC\">Download the Scripts </h2><ol>\n<li data-list-item-id=\"e24e3ba4448c4e1ef3f25f054fc2a7c0a\">Open <em>Terminal.</em>\n</li>\n<li data-list-item-id=\"e053399cdc80a373e917ff2cb4f1ee539\">Clone the manual connection scripts repository:</li>\n</ol><pre class=\"wysiwyg-code-block\"><code class=\"language-auto\">git clone https://github.com/pia-foss/manual-connections.git</code></pre><ol start=\"3\"><li data-list-item-id=\"eb4d2485770c3a988309edc19a7e04936\">Change to the manual connection scripts directory:</li></ol><pre class=\"wysiwyg-code-block\"><code class=\"language-auto\">cd manual-connections</code></pre><p>You can also download the repository as a compressed folder from GitHub, then extract it before you continue.</p><h2 id=\"h_01KZ3CYCFAX1KVN51133FDWGMR\">Use the Scripts</h2><p>Each <em>.sh</em> script performs a specific task or set of tasks. You can run some scripts independently if you provide the required variables.</p><p>The <em>run_setup.sh</em> script works differently. It prompts you for the required information, then runs the other scripts based on your responses. This is the easiest way to use the manual connection scripts.</p><ol><li data-list-item-id=\"e76611e001875f49ce404e3e18b0f08d8\">From the <em>manual-connections</em> directory, run:</li></ol><pre class=\"wysiwyg-code-block\"><code class=\"language-auto\">sudo ./run_setup.sh</code></pre><ol start=\"2\">\n<li data-list-item-id=\"e9ce6defc322a299c7261cddab5189fd6\">Enter your system administrator password when prompted. This is your computer password, not your PIA account password.</li>\n<li data-list-item-id=\"ea504cb37237ca95272e93cbd4dfd1113\">Enter your PIA username and password when prompted. The password field doesn’t show the characters you type. This is expected.</li>\n</ol><p><img style=\"box-shadow: 0px 0px 10px 2px rgba(0, 0, 0, 0.2);\" src=\"https://helpdesk.privateinternetaccess.com/hc/article_attachments/53896713205275\" alt=\"Terminal showing the PIA manual connection login screen.\" width=\"1239\" height=\"577\"></p><ol start=\"4\"><li data-list-item-id=\"e9d1b9f0bbd9e7fce5f5eaa5731649b40\">Follow the prompts to choose the connection type and settings you want to use. The option with a capital letter is the default option. If you press <em>Enter</em> without typing a response or enter something the script doesn't recognize, the script uses the default option.</li></ol><p><img style=\"box-shadow: 0px 0px 10px 2px rgba(0, 0, 0, 0.2);\" src=\"https://helpdesk.privateinternetaccess.com/hc/article_attachments/53896713205403\" alt=\"Terminal showing the PIA manual connection configuration.\" width=\"1068\" height=\"947\"></p><ol start=\"5\"><li data-list-item-id=\"ee6192ef01622f71d8e7b6beb7a967b97\">The script will then attempt to establish an OpenVPN or WireGuard connection. If the connection fails, the terminal output provides information about the issue, such as incorrect login credentials.</li></ol><figure class=\"wysiwyg-image\"><img style=\"aspect-ratio: 1237/512; box-shadow: 0px 0px 10px 2px rgba(0, 0, 0, 0.2);\" src=\"https://helpdesk.privateinternetaccess.com/hc/article_attachments/53896713206427\" alt=\"Terminal showing the PIA manual configuration successfully connecting.\" width=\"1237\" height=\"512\"></figure><p><strong>Note: </strong>Once successfully connected, the script closes, but your VPN connection stays active in the background. You don't need to keep the terminal window open unless you’re <a href=\"#h_01KZ3CYCFRQ901X991QDSMSB10\">using port forwarding</a>.</p><h2 id=\"h_01KZ3CYCFJ51CANE8BDFF71HRQ\">Manage Connections</h2><p>To disconnect later, open any terminal window and run the command for your connection type:</p><ul><li class=\"wysiwyg-list-bold\" data-list-item-id=\"e028a56335eb9f947451cf3f1c1af82f1\"><strong>WireGuard: </strong></li></ul><pre class=\"wysiwyg-code-block\"><code class=\"language-auto\">wg-quick down pia</code></pre><p><strong>To reconnect:</strong> WireGuard also saves a config file at /etc/wireguard/pia.conf, so you can quickly reconnect later without re-running the full setup by running:</p><pre class=\"wysiwyg-code-block\"><code class=\"language-auto\">wg-quick up pia</code></pre><ul><li class=\"wysiwyg-list-bold\" data-list-item-id=\"e219f2ff93a4005607ec144b34df1bc15\"><strong>OpenVPN: </strong></li></ul><p>When your OpenVPN connection succeeds, the script prints a ready-to-use disconnect command near the end of its output, with the process ID already filled in. To disconnect, you need to use the kill command alongside the process ID for your connection. For example:</p><pre class=\"wysiwyg-code-block\"><code class=\"language-auto\">sudo kill 1234</code></pre><p>Just replace 1234 with the actual number shown in your terminal output. </p><p><strong>To reconnect:</strong> Unlike WireGuard, OpenVPN connections don't save reusable config files, so you'll need to run <em>run_setup.sh</em> again each time you want to reconnect.</p><h2 id=\"h_01KZ3CYCFRQ901X991QDSMSB10\">Use Port Forwarding</h2><p>If you use the port forwarding feature, keep the script window open. Port forwarding may time out after 15 minutes or less if you close the script window.</p><p>The terminal output provides the forwarded port assigned to you and shows when it will time out. If you close the terminal window while using port forwarding, your VPN connection remains active until you run the command to disconnect it.</p><p><strong>Note: </strong>Port forwarding is not available to users in the U.S.</p><h2 id=\"h_01KZ3CYCFVKH9YJ54MPC99V5NC\">Use One-Line Calls</h2><p>You can also run the scripts with one-line calls instead of using the prompt-based setup. For example, this command starts a WireGuard connection if you replace the placeholder username and password with valid PIA account credentials:</p><pre class=\"wysiwyg-code-block\"><code class=\"language-auto\">sudo PIA_USER=p1234567 PIA_PASS=xxxx1234 DIP_TOKEN=no PIA_PF=true PIA_DNS=true DISABLE_IPV6=yes PREFERRED_REGION=ca_vancouver VPN_PROTOCOL=wireguard ./run_setup.sh</code></pre><p><strong>Note: </strong>If you want to <a href=\"https://helpdesk.privateinternetaccess.com/hc/en-us/articles/46565997342747-Do-You-Offer-Dedicated-IP-Addresses\"><span class=\"wysiwyg-underline\">use a dedicated IP address</span></a>, set<em> DIP_TOKEN</em> to your actual token value instead of <em>no.</em></p><p>For more information about one-line calls and supported variables, review the <em>README.md</em> file included with the scripts.</p>","user_segment_ids":[]}}