VPN and Samba on Linux — easier than I expected

I have the server.ovpn file that OpenVPN GUI reads in and uses on Windows. I’d like to use a Linux client. I am running Debian.

First, we use NetworkManager (installed by default unless you did a minimal, customised installation). I install network-manager-openvpn, openvpn, resolvconf, network-manager-openvpn-gnome (though I am using the MATE desktop), samba and cifs-utils and remmina and its RDP plug-in, and for good measure openvpn-systemd-resolved — not 100% sure I need them all (and some are not relevant for this specific post), but …

$ sudo systemctl restart networkmanager

(This makes sure NetworkManager knows all these new toys have been installed.) I used openvpn from the command line to make sure I could make a connection:

$ sudo openvpn --config path/to/server.ovpn

and I could see machines on the VPN (for example, I could ping the server), so that was good. I knew it could work.

Then, went to NetworkManager in the MATE status bar and asked for a new VPN connection, OpenVPN compatible, using a saved configuration, and browsed to my ovpn file. Accepted all defaults and saved the connection, then chose it; was pleasantly surprised when it worked immediately.

Now, to mount the file shares. Ran caja (nautilus if you use gnome) and File > Connect to server > Chose Windows Share as the type, then put the server name (well, IP4 address, but a name would probably have worked as well or better) in the server box. Put the folder in the folder box (with leading /), domain (workgroup in Windows lingo) in its box, then username and password. Checked ‘make a shortcut’ and gave it a name; that also worked out of the box (files showed up in caja), so most of the functionality is there.

A few tips.

  • If you ever have to log into a Windows desktop or other account with something like “COMPANY\username” then COMPANY might work as a domain in the caja connection.
  • Don’t enter the folder and server like \\server\folder like you would in Windows — put server in one box and folder in the other.
  • Using an explicit IP4 address (123.234.345.345) might work but the server hostname is generally to be preferred; but I find that sometimes one works, sometimes the other, so you can try both. Server IP addresses are usually pretty stable — unlikely to be allocated by DHCP!
  • Most ovpn files contain the options needed in the top section. In my case, this meant that I did not do any config changes, just accepted what the saved config imported into NetworkManager. Maybe I was lucky …?
  • Where you would find the mounted folders in the Linux file system can be tricky. Some advice says ~/.gvfs, some ~/.cache/gvfs, some put the files in the /run tree. Given that we have not used superuser to do any of this, I’d expect the files to be in your personal file space, but YMMV. You might have to hunt around for the mount point.

Once you have the VPN working, you may be able to use RDP to work on a remote computer, as well as access files as I have done here.

Does not need sudo or root or superuser or whatever you want to call it.

OpenVPN upload problems — update the client

I don’t know if it is my connection, the local config, the server config or what, but I can download any amount of stuff from the server, I cannot upload anything bigger than a few KB.

So … how about installing the latest OpenVPN Community client? (https://openvpn.net/community-downloads/) (OpenVPN-2.5.1-I601-x86.msi)

Note: I found that an upload from a Windows box worked when one from a Windows instance running in VirtualBox did not. But the Windows box also used a later version of the OpenVPN client. So 2 possibilities:

  1. The updated client is the trick.
  2. Bridged instead of NAT networking on VB might help. Maybe the extra layer through VirtualBox is the problem…

Solution:

Installed the latest OpenVPN client and …

So far, the update seems to have sorted things out.

 

Hoorayvpn

Typical OpenVPN procedure on Windows 10

Note to self.

To install VPN software:

  1. Go to https://openvpn.net/community-downloads/ and choose the right file (for example, Windows 10 installer)
  2. Run the installer.
  3. Check ‘Easy RSA admin scripts’ — why not? (Don’t know if this matters. Did not hurt.)
  4. Copied configandkeyfile.ovpn to C:\Program Files\OpenVPN\config
  5. Run OpenVPN GUI (double-click desktop icon)
  6. Icon appears in system tray (menu at bottom right); click through menus and choose Connect

One way of getting the installer:

$ wget https://swupdate.openvpn.org/community/releases/openvpn-install-2.4.8-I602-Win10.exe

They key/config file comes from your system administrator. Copy it into the config directory of OpenVPN. Of course, installation and copying require administrator access.

Run the thing by double-clicking the OpenVPN GUI icon on the desktop. It will start up a window, then close it again and you’ll have a new icon in the system tray — the bottom right of the status bar or whatever it is called at the bottom of the screen. You know, the little menu you bring up by clicking on the chevron or up-positing arrow, a bit like ⌃.

The little icon looks like a computer monitor with a padlock on it. Right click on it and choose ‘Connect’. If all goes well, a window will flash up, some text will scroll, and you’ll get some message about having been assigned an IP address or something.

Presumably, you’ll want to map a network drive. Here we go.

  1. Open the file explorer and choose ‘This PC’ from the menu on the left.
  2. The option ‘Map network drive’ should appear in the toolbar at the top.
  3. Choose it!
  4. Choose the drive letter and the server and folder. The server could have a name, or it could be an IP address, like \\123.345.456.12\folder. Your IT support will usually tell you what to call it. Once you know one of them, you might be able to guess others.
  5. I uncheck reconnect at sign in, because it usually fails.
  6. I check connect using different credentials unless my desktop login is the same as the server login.
  7. Click finish.
  8. If using different credentials, you’ll be asked for a password. It should say ‘Attempting to connect to …’ and if that works the folder will open in file explorer.

Done.

Click on This PC and Map network drive
Choose a drive letter and put in the server and folder details

 

As Beethoven would say, done done done done