

Hit CTRL+O to write the contents to disk, then CTRL+X to quit nano.Ĥ. Create a text document that has nothing except your username for the VPN provider on the first line, and your password on the second.ģ. This should open up the nano text editor.Ģ. N avigate to /etc/openvpn and type sudo nano vpnlogin. We can alter this line to automatically feed a username and password to our config file when it is called.ġ. These include a line that contains "auth-user-pass". You should see that it starts with client and that there’s a list of commands. Take a look at the VPN files you downloaded to your desktop and open one of them. Good, but it could be better – we’re going to create a few scripts to automatically create your credentials. So far we have a slightly cumbersome way of connecting our Pi to a VPN via a terminal which requires you to enter your username and password when you want to connect. You should see a connection marked "TUN", which is your VPN tunnel. Do test to see if the connection is working by typing ifconfig. If you try this now, you’ll notice that the script asks for your username and password to authenticate the connection. O pen a connection to any of these servers using the command sudo openvpn example.ovpn –daemon where "example" is the filename of the configuration file. You’ll need to move the files to the etc/openvpn directory using the mv command.ĥ. Note that some VPN providers may have packaged these files with subdirectories, for example for connections encrypted with optional 128bit or 256bit protection. There should be a list of files ending in. If you’re using a headless Pi, connect via SSH.Ī quick "ls" command will show if you have been successful. Log into your Pi and navigate to the command prompt. Download them and unzip them into a folder on your desktop.ġ. You should find these configuration files on your VPN provider’s website (ours are at /servers). We opted for two UK and two US servers, choosing one that supports the UDP protocol and one that supports TCP/IP.

There are usually a lot of these – one for each server you have the option to connect to – so pick a handful that you want to be able to quickly access. Your provider’s OpenVPN configuration files and encryption certificates.We’re going to use Nord VPN, which is a popular choice among the most demanding privacy advocates, but there are plenty of other good services out there, some of which are faster or cheaper. A subscription to a VPN service of your choice.You can also use a non-headless Pi, but connecting remotely is more convenient.

See our article on how to create a headless Raspberry Pi for details.
