This is not a doubt, but a step-by-step how to make it works.
- Clone “devian-11” template. Let’s call it “debian-11-nordvpn”.
- Open “debian-11-nordvpn” terminal and install nordvpn according the link below. Do whatever you need to do by you own and risk to install it.
https://support.nordvpn.com/Connectivity/Linux/1325531132/Installing-and-using-NordVPN-on-Debian-Ubuntu-Raspberry-Pi-Elementary-OS-and-Linux-Mint.htm
-
Go to “Qube Manager” and create a New Qube named “nordvpn”, with “debian-11-nordvpn” as template. All other options keep then as standard.
-
After install nordvpn, create a folder named “autostart” in “/home/user/.config”
sudo mkdir /home/user/.config/autostart
- Access autostart folder
cd /home/user/.config/autostart
- Now access nano to create a file named “nordvpn.desktop”
sudo nano nordvpn.desktop
- A editor will be opened and so you must type:
[Desktop Entry]
Name=nordvpn
Type=Application
Exec=/home/user/.config/autostart/nordvpn.sh
-
After type, press CTRL+O, ENTER and CTRL+X and leave nano.
-
Now, still in “/home/user/.config/autostart/” folder, create the script file names “nordvpn.sh”:
“sudo nano nordvpn.sh”
- Now type in “nordvpn.sh” the follow code:
#!/bin/sh
nordvpn set analytics off
nordvpn set killswitch on
nordvpn set notify on
nordvpn set killswitch on
nordvpn login --token replace.by.your.nordvpn.token.here
sleep 5s
nordvpn c
sleep 5s
nordvpn set autoconnect on
NORDVPN TOKEN can be found following these steps: How to use a token with NordVPN on Linux? | NordVPN support
-
Press CTRL+O, ENTER and CTRL+X
-
Now, and most important step is to change files permissions before start to use. Still in “/home/user/.config/autostart” folder, in terminal, type:
sudo chmod +x nordvpn.desktop && sudo chmod +x nordvpn.sh
- Now you can test the script. Still in “/home/user/.config/autostart” folder, in terminal, type “./nordvpn.sh”. The expected result must be:
- Now restart you “nordvpn” App Qube. After it restart open a terminal windows and type:
nordvpn status
DO NOT type “./nordvpn.sh” after this restart.
The expected result must be something like this:
Enjoy!
I have “UPGRADED” my nordvpn.sh script (n0t “nordvpn.desktop”) to make a random choice of the country to connect.
So, my nordvpn.sh - version 01 - is:
#!/bin/sh
nordvpn set analytics off
nordvpn set killswitch on
nordvpn set notify on
nordvpn set killswitch on
nordvpn login --token my.token.here
sleep 5s
countries=("Albania" "Germany" "Poland" "Argentina" "Greece" "Portugal" "Australia" "Hong_Kong" "Romania" "Austria" "Hungary" "Serbia" "Belgium" "Iceland" "Singapore" "Bosnia_And_Herzegovina" "Indonesia" "Slovakia" "Brazil" "Ireland" "Slovenia" "Bulgaria" "Israel" "South_Africa" "Canada" "Italy" "South_Korea" "Chile" "Japan" "Spain" "Colombia" "Latvia" "Sweden" "Costa_Rica" "Lithuania" "Switzerland" "Croatia" "Luxembourg" "Taiwan" "Cyprus" "Malaysia" "Thailand" "Czech_Republic" "Mexico" "Turkey" "Denmark" "Moldova" "Ukraine" "Estonia" "Netherlands" "United_Kingdom" "Finland" "New_Zealand" "United_States" "France" "North_Macedonia" "Vietnam" "Georgia" "Norway" "double_vpn")
selected_country=${countries[RANDOM % ${#countries[@]}]}
nordvpn c "$selected_country"
nordvpn set autoconnect on
As you can see, in “countries” list there’s one named “double_vpn”. That’s what this “country” do:
**nordvpn c double_vpn** - Connect to the closest Double VPN server.
Read more about “nordvpn” linux commands here: Installing NordVPN on Linux distributions | NordVPN support
Another “UPGRADE” is to add a time to change from one server to another after few time.
This version 02 is:
#!/bin/sh
nordvpn set analytics off
nordvpn set killswitch on
nordvpn set notify on
nordvpn set killswitch on
nordvpn login --token my.token.here
sleep 5s
countries=("Albania" "Germany" "Poland" "Argentina" "Greece" "Portugal" "Australia" "Hong_Kong" "Romania" "Austria" "Hungary" "Serbia" "Belgium" "Iceland" "Singapore" "Bosnia_And_Herzegovina" "Indonesia" "Slovakia" "Brazil" "Ireland" "Slovenia" "Bulgaria" "Israel" "South_Africa" "Canada" "Italy" "South_Korea" "Chile" "Japan" "Spain" "Colombia" "Latvia" "Sweden" "Costa_Rica" "Lithuania" "Switzerland" "Croatia" "Luxembourg" "Taiwan" "Cyprus" "Malaysia" "Thailand" "Czech_Republic" "Mexico" "Turkey" "Denmark" "Moldova" "Ukraine" "Estonia" "Netherlands" "United_Kingdom" "Finland" "New_Zealand" "United_States" "France" "North_Macedonia" "Vietnam" "Georgia" "Norway" "double_vpn")
nordvpn set autoconnect on
while true; do
selected_country=${countries[RANDOM % ${#countries[@]}]}
nordvpn c "$selected_country" &
# Countdown
for ((i=900; i>=0; i--)); do #a timer of 900 seconds (15 minutes) here
minutes=$((i / 60))
seconds=$((i % 60))
printf "Next server change in: %02d:%02d\r" "$minutes" "$seconds" #just to show in terminal if you want to see
sleep 1
done
echo ""
done
If you found any bug or improvement, please, let me know.