How to set up and use a NordVPN OpenVPN manual connection as a standard user? (sudo required for setup)

In this article, you will learn how to configure a manual OpenVPN connection on Linux for a non-administrative account. This setup allows a standard user to initiate a secure VPN connection using a script while maintaining system security through specific sudo permissions. These instructions are updated and work for a Ubuntu 24.04 LTS device using the US #10140 server and the UDP protocol.

Before you start:

  • A Linux operating system version that is supported by the OpenVPN program.
  • Administrative (sudo) access for the initial setup.
  • The first 7 steps of the NordVPN Linux manual OpenVPN connection setup tutorial must be completed (OpenVPN packages installed and NordVPN .ovpn server files downloaded).
  • Your NordVPN service credentials (found in the Nord Account dashboard).
  • Note: In this guide, we use myuser as a placeholder for the standard user's account name. Replace it with your actual username. Additionally, you can use older Ubuntu builds than those written in the article; however, we are not able to confirm that it would work.

Here's what to do:

Step 1: Create the connection script

  1. Log in to your admin account.
  2. Open the Terminal (Ctrl + Alt + T) and navigate to the Documents folder:
  3.  cd ~/Documents/
  4. Create a new file named connect-vpn.sh: 
  5. nano connect-vpn.sh
  6. Enter the following lines into the editor:
  7. #!/bin/bash
    sudo openvpn /etc/openvpn/ovpn_udp/us10140.nordvpn.com.udp.ovpn
  8. Save and close the file (Press Ctrl + O, then Enter to save, and Ctrl + X to exit).
  9. Make the script executable:
 chmod +x ~/Documents/connect-vpn.sh

Step 2: Configure sudo permissions

This step allows the standard user to run the VPN script and the OpenVPN binary without being prompted for an administrative password.

  1. In the terminal, create a new sudoers policy file: 
  2. sudo visudo -f /etc/sudoers.d/nordvpn-user
  3. Add the following lines to the file, replacing myuser with the actual standard username:
  4. myuser ALL=(ALL) NOPASSWD: /home/myuser/Documents/connect-vpn.sh
    myuser ALL=(ALL) NOPASSWD: /usr/sbin/openvpn
    myuser ALL=(ALL) NOPASSWD: /etc/openvpn/ovpn_udp/us10140.nordvpn.com.udp.ovpn
  5. Save and exit the editor (Press Ctrl + O, Enter, and then Ctrl + X).
  6. Validate the syntax and set the required permissions for the policy file:
  7.  sudo chmod 440 /etc/sudoers.d/nordvpn-user

Step 3: Switch to the standard user account

  1. Log out of your administrative account or use the user switcher in the top-right corner of the Ubuntu desktop.
  2. Log in to the Standard User account (myuser).

Step 4: Connect to the VPN

  1. Open the Terminal (Ctrl + Alt + T).
  2. Navigate to the directory containing your script:
  3.  cd ~/Documents
  4. Run the script to establish the connection:
  5.  ./connect-vpn.sh
  6. Enter your NordVPN service credentials when prompted.
  7. Wait for the connection to be established. You will see the message: Initialization Sequence Completed.

Additional tips

  • Server Changes: If you want to connect to a different server, you must update the file path in both the connect-vpn.sh script and the /etc/sudoers.d/nordvpn-user file.
  • Security: Using a drop-in file in /etc/sudoers.d/ is safer than editing the main sudoers file, as it keeps your custom permissions organized and prevents accidental system-wide lockouts.
Was this article helpful?

Still having issues?

  • Live chat

  • Email form

By clicking “Chat with support”, you agree to our Terms of Service and acknowledge our Privacy Policy. Chat functionality relies on cookies. By starting the chat, you agree to their use. Learn more in our Cookie Policy.