• Home
  • SEM
    • PPC
    • SEO
    • How To
  • Bangladesh
  • School
    • HTTP
    • REP
    • Bots n’ htaccess
    • Source Code
    • Excel 2010
    • HTML XHTML Entities
    • Gmail Operators
    • HTML & ASCII
  • About
    • Privy
    • About This Blog
  • Contact
  • বাংলা

Saidul Hassan

Digital Marketing Evangelist

Home / How to / HMA Pro VPN Setup for Multiple Locations without User/Password Every time in Linux CLI

HMA Pro VPN Setup for Multiple Locations without User/Password Every time in Linux CLI

14 May, 2018 By Saidul Hassan · Filed Under: How to, Linux Mint

VPN setup with network manager GUIYou can of course setup per location with Network Manager GUI. And you can use HMA script the usual way (hma-openvpn.sh or hma-vpn.sh) with linux CLI. Network manager GUI method is perfect if you only need to connect to 1 or 2 locations. HMA! Linux Scripts CLI is all the way perfect for everything if you’re frequent linux command line user and don’t mind typing your HMA Pro user/password login credentials over and over again.

However if you’re like me, ie. frequently connect to different countries & locations and are not so apt in using terminal too much, and annoyed by the fact that you’ve to type your HideMyAss Pro VPN username and password everytime you use HMA VPN client; your best solution is OpenVPN® via terminal using openvpn binary (the “manual way”)with a little improvisation. HMA! Linux Scripts 
All of the steps described here are documented on support.hidemyass.com but they are scattered and may not be too evident to new linux users like me. If you wish to use the GUI method of Network Manager in Linux Mint with OpenVPN®, PPTP or IPSec setup,check the document here. However the IPSec method uses Shrew Soft VPN and for unknown reason I couldn’t connect successfully with that. And if you’d prefer HideMyAss recommended Linux CLI OpenVPN® Client – HMA! Linux Scripts, check the how to here. If you’d prefer OpenVPN® binary (the “manual way”), read on.

Whatever method you choose, you’re likely to need few downloads like

  1. HMA! Linux Scripts: hma-linux.zip
  2. All UDP & TCP VPN server configuration files in a .ZIP archive :vpn-configs.zip
  3. VPN configuration to use with Shrew Soft VPN client for IPSec protocol: shrewsoft-ipsec.zip. Useless for our setup today, but for Android IPSec VPN Setup, there is nothing better than this How to connect using IPSec protocol.

Now the actual how to Setup HMA Pro VPN for Multiple Locations with saved username & password in Linux CLI:

  1. Make sure you have openvpn package already installed, if not- do it simply by running $ apt install openvpn in terminal.
  2. Download one-by-one single *.ovpn VPN server configuration files for your chosen location for TCP protocol or UDP protocol. Or
    All config files in a .ZIP file mentioned above.
  3. Make sure you’re in a folder where *.ovpn files are stored. For example ~/VPN. If not, do so by typing in terminal $ cd VPN.
  4. Now just run the OpenVPN® binary with one of the config files as parameter, like this in terminal:
    $ sudo openvpn UK.UDP.ovpn
  5. You will be asked for your HMA! Pro VPN account username and password, and after you correctly type them, the connection will be made.
  6. Save username and password to avoid this forever. Create “id-file.hma” file in the same folder where the *.ovpn VPN server configuration files is located. in our example in ~/VPN. The content of the “id-file.hma” file should only be username and password, one below the other with no additional entries.
    username
    password
    Save username and password for HMA
  7. If you keep your UDP folder and TCP folder separate, you will have to put the “id-file.hma” file in each folder.I personaly use UDP and copied all preferred location files into same folder:
    VPN folder containing ovpn and credential file
  8. Then you would need to edit the *.ovpn configuration file you would like to use (I will use UK.UDP.ovpn) by finding the: auth-user-pass entry inside and then add next to it the name of the credentials file (id-file.hma) so that it would read:auth-user-pass entry
  9. Instead of editing each *.ovpn file one-by-one, you can use sed command using terminal
    $ sed -i 's/auth-user-pass/auth-user-pass\ id-file.hma/g' *.ovpn
    Make sure you’re in the same folder in the terminal while running the command.
  10. Next time all you have to do is, navigate into the folder by $ cd VPN and then type $ sudo openvpn in the terminal and drag the desired location configuration file onto the terminal and press enter. You will be asked to provide your sudo password, then it will connect you without asking your HMA username/password ever again. Once you see the terminal output reads "Initialization Sequence Completed", know that you’re connected.
    Initialization Sequence Completed
  11. Finally check your IP from https://www.hidemyass.com/ip-info or any of your favorite tools.
Link to this post!
The following two tabs change content below.
  • Bio
  • Latest Posts
My Twitter profileMy Facebook profileMy Google+ profileMy LinkedIn profileMy Instagram profileMy Pinterest profile

Saidul Hassan

Managing Partner at Up Arrow Consulting
COO at Up Arrow Consulting, MCC manager, & Technical SEO consultant. Certified Google Partners and Microsoft Bing Ads Accredited Professional, Python enthusiast, wannabe SysAdmin. Graduated from School of Management & Business Administration (SOMBA), Khulna University.
My Twitter profileMy Facebook profileMy Google+ profileMy LinkedIn profileMy Instagram profileMy Pinterest profile

Latest posts by Saidul Hassan (see all)

  • Batch script to create directories & moving fixed number of files to those directories - 30 Apr, 2021
  • How to use PrismJS syntax highlighter on WordPress without plugin - 30 Mar, 2020
  • Download an Entire Website for Offline Viewing - 26 Nov, 2019

Share:

  • Twitter
  • Facebook
  • LinkedIn
  • Pinterest
  • Pocket
  • Email
  • Print

First published on 14 May, 2018 · Last updated 14 May, 2018 · Tagged With: CLI, hidemyass, HMA, How To, VPN

Batch script to create directories & moving fixed number of files to those directories

30 Apr, 2021 By Saidul Hassan

How to use PrismJS syntax highlighter on WordPress without plugin

30 Mar, 2020 By Saidul Hassan

Download an Entire Website for Offline Viewing

26 Nov, 2019 By Saidul Hassan

How to color highlight .htaccess files in Xed/Gedit

20 Aug, 2018 By Saidul Hassan

HMA Pro VPN Setup for Multiple Locations without User/Password Every time in Linux CLI

14 May, 2018 By Saidul Hassan

  • ♥ Bangladesh ♥
    Log in · Privacy Policy · Contact
    Copyright © 2011 Saidul Hassan

  • DMCA

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.