< Back

How to set up manual OpenVPN connection using Linux Terminal?

In this tutorial, you will learn how to set up an OpenVPN connection on your Linux device. This is an alternative way of connecting to Surfshark servers that will come in handy if the Surfshark VPN app can not be installed on your device, or it does not perform as expected.

You will need a device running Linux operating system and an active Surfshark subscription. If you don’t have the subscription yet, you can get it here.

 

This tutorial was made using Ubuntu distribution. Please note that some configurations may vary depending on the Linux distribution you are using.

 

Get your credentials

 

You will need Surfshark service credentials to connect to the VPN using a manual OpenVPN connection. Do not confuse these with your regular credentials, namely your email address and your password.

Here is how you can get Surfshark service credentials:

  1. Go to this page where all the details required for manual connection are stored.

    You may need to log in before proceeding to this page. In that case, enter your email address and your password, then click Log in.

  2. Click on the Credentials tab. You will find Surfshark service credentials there.

    It is a good idea to keep this page open for now. You will need these credentials a bit later.

    Manual_credentials.png

 

 

Install the OpenVPN package

 

  1. Open the terminal window.

    You can do that by pressing Ctrl+Alt+T keys or navigating to it in your apps menu.

    Screenshot_1.png

  2. Enter this command to install all the necessary packages:

    sudo apt-get install openvpn unzip

    You may need to enter your computer password to confirm this process. In such a case, enter the password and press Enter.


    install_necessary_packages_and_enter_password.png

Download configuration files

 

  1. Navigate to the OpenVPN directory. You can do that by entering this command:

    cd /etc/openvpn

    navigate_to_the_directory.png

  2. Download Surfshark OpenVPN configuration files:

    sudo wget https://my.surfshark.com/vpn/api/v1/server/configurations

    navigate_to_the_directory_and_download_configurations_-_Copy.png

  3. Extract configurations.zip with this command:

    sudo unzip configurations

    unzip_configs.png


  4. To see the list of all the available servers, enter:

    ls


    see_the_full_list.png

 

Connect to the VPN

 

  1. Choose one server from the list that you want to connect to and copy the hostname (URL) representing this server's hostname.

    copy_the_name_of_config_file.png

  2. Connect to this server by entering this command:

    sudo openvpn paste the server name here

    For example, if you'd like to connect to the us-slc server, this will be the command:

    sudo openvpn us-slc.prod.surfshark.com_udp.ovpn

    connect_to_this_server.png

  3. Before connecting to the server, you should enter Surfshark service credentials.

    Enter the credentials that you have collected in the 'Get your credentials' part, and press enter.

    enter_credentials.png

  4. You have successfully connected to Surfshark if you can see the 'Initialization Sequence Completed' line in your terminal. 

    connected.png

  5. To disconnect from the OpenVPN connection, open the terminal and press Ctrl + C.

    disconnect_from_the_VPN.png

    Congratulations - you have successfully configured OpenVPN manual connection! As long as you’re connected, your location is private, and your sensitive data is secure.

    If you have any further questions, our customer success team is here to help you 24/7 over a live chat or email.



    You may also be interested in:
  1. How to make sure if my connection was successful?
  2. How to enable 2FA on your Surfshark account?
  3. Connect to Surfshark VPN using Ubuntu Network Manager
Was this article helpful?