This guide shows you how to connect Linux to PremierVPN with OpenConnect, the open-source AnyConnect-compatible client. You can use it from the terminal or through NetworkManager. It connects over port 443, so it often works on networks that block other VPN types.
Want a desktop app instead? PremierVPN has a native Linux app with WireGuard and a kill switch for Ubuntu and Debian and Fedora, RHEL, Rocky and AlmaLinux. The app signs in with your portal email and password.
Before you start: use your VPN credentials
Manual setups sign in with your VPN username and VPN password. These are separate from the email and password you use for the portal and the PremierVPN apps, and the portal login will not work here.
- Find both on your Dashboard under Your VPN credentials. Click Show to reveal the password.
- To change the VPN password, go to Settings › VPN Password. The new password applies from your next connection.
- Not sure which login is which? See Understanding your VPN credentials.
Install OpenConnect
Ubuntu / Debian:
sudo apt install openconnect
Fedora / RHEL / Rocky / AlmaLinux:
sudo dnf install openconnect
Arch Linux:
sudo pacman -S openconnect
Connect from the terminal
sudo openconnect --user=YOUR_VPN_USERNAME uk.premiervpn.net
Enter your VPN password when asked. Keep the terminal open while you use the VPN, and press Ctrl+C to disconnect. To use another location, swap in any hostname from the table below.
Connect with NetworkManager (GNOME, KDE and others)
- Install the NetworkManager plugin:
sudo apt install network-manager-openconnect-gnomeOn Fedora and similar:
sudo dnf install NetworkManager-openconnect-gnome - Open Settings › Network, and click + next to VPN.
- Choose Multi-protocol VPN client (openconnect).
- Set the VPN protocol to Cisco AnyConnect or openconnect and the Gateway to a hostname, for example
uk.premiervpn.net. - Click Add, then switch the VPN on. Enter your VPN username and VPN password when asked.
Run in the background
Store your VPN password in a file only root can read, then start OpenConnect in the background:
sudo install -m 600 /dev/null /etc/premiervpn-pass
printf '%s\n' 'YOUR_VPN_PASSWORD' | sudo tee /etc/premiervpn-pass > /dev/null
sudo sh -c 'openconnect --user=YOUR_VPN_USERNAME --passwd-on-stdin --background --pid-file=/run/openconnect.pid uk.premiervpn.net < /etc/premiervpn-pass'
To disconnect:
sudo kill $(cat /run/openconnect.pid)
Start the VPN at boot with systemd
Create /etc/systemd/system/premiervpn.service with this content:
[Unit]
Description=PremierVPN (OpenConnect)
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/sbin/openconnect --user=YOUR_VPN_USERNAME --passwd-on-stdin --non-inter uk.premiervpn.net
StandardInput=file:/etc/premiervpn-pass
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
Then enable and start it:
sudo systemctl daemon-reload
sudo systemctl enable --now premiervpn
If openconnect is installed somewhere else on your system, check the path with command -v openconnect and update ExecStart.
Server hostnames
You can also copy any hostname from the Servers page in the portal.
| Location | Hostname |
|---|---|
| Denmark | dn.premiervpn.net |
| Finland | fn.premiervpn.net |
| France | fr.premiervpn.net |
| Germany | de.premiervpn.net |
| Israel | isr.premiervpn.net |
| Italy | it.premiervpn.net |
| Netherlands | nl.premiervpn.net |
| Norway | no.premiervpn.net |
| Poland | pl.premiervpn.net |
| Romania | ro.premiervpn.net |
| Spain | sp.premiervpn.net |
| Sweden | sw.premiervpn.net |
| Switzerland | swiss.premiervpn.net |
| Turkey | tr.premiervpn.net |
| United Kingdom (London) | uk.premiervpn.net |
| Argentina | ar.premiervpn.net |
| Brazil | br.premiervpn.net |
| Canada | ca.premiervpn.net |
| Mexico | mx.premiervpn.net |
| Peru | pe.premiervpn.net |
| United States (Kansas) | ks.premiervpn.net |
| United States (Los Angeles) | la.premiervpn.net |
| United States (New York) | ny.premiervpn.net |
| United States (Santa Clara) | sc.premiervpn.net |
| Australia | au.premiervpn.net |
| Hong Kong | hk.premiervpn.net |
| India | in.premiervpn.net |
| Japan | jp.premiervpn.net |
| Singapore | sg.premiervpn.net |
| South Korea | sk.premiervpn.net |
Troubleshooting
"Login failed" or the password is rejected
- Use your VPN username and VPN password from the Dashboard, not your portal email and password.
- If you use a password file, make sure it holds your current VPN password with no extra spaces.
Certificate verification failed
Our servers use a publicly trusted certificate, so this usually means the hostname is mistyped or your CA certificates are out of date. Check the hostname, then update the ca-certificates package. Don't turn off certificate checks.
Can I send only some traffic through the VPN?
By default all traffic goes through the VPN. OpenConnect can run a custom routing script (for example the third-party vpn-slice tool) through its --script option if you want split tunnelling. This is an advanced setup.
Still stuck? Open a support ticket and tell us your distribution, the command you ran and the error you see.