Mounting Windows WUR shares in Linux

Table of Contents
Motivation
At Wageningen University & Research the Linux Operating System is supported on a best effort principle, meaning that it is supported as far as the knowledge of Facilities and Services Information Technology (FB-IT) reaches. FB-IT is supported by their colleagues maintaining the High Performance Computing Cluster Anunna, who have a lot of knowledge about the Linux Operating System, because it’s the Operating System used by Anunna.
On the other hand Linux users are generally users, who are very independent and know how to search for and implement solutions themselves. Being one of those Linux users within WUR myself I want to share in this post, how I mount Windows shares from Wageningen University & Research within my Linux systems.
Mounting WURNET shares
The method of mounting Windows shares from Wageningen University & Research, described in this post, uses the Common Internet File System (cifs) via the /etc/fstab
file. This allows for automatic mounting of Windows shares during boot, when the computer is physically within WURNET.
A prerequisite for the described method is that the common internet file system utilities cifs-utils
are available on your Linux system. When in doubt, open a terminal and execute, one by one, the following commands:
sudo apt update
sudo apt install cifs-utils
Create a credentials file in your HOME directory
The procedure described, using the /etc/fstab
file, requires a credentials file to store your WUR Windows username and password. This credentials files needs to be stored in the root of your HOME directory /home/localusername
, where localusername
is your username on the Linux system.
Open a terminal and change the directory with:
cd ~
Print the current directory with pwd
and confirm that you are in /home/localusername
, where localusername
reflects the username on your Linux system.
Create a credentials file, e.g. .smbpassword
, with the following command:
touch .smbpassword
Using your favorite editor, e.g. VIM, Emacs, nano or whatever editor your prefer, edit .smbpassword
and add the following lines:
username=user001
password=your-windows-password
domain=WUR
Here user001
is your WUR username and your-windows-password
is the current WUR Windows password, which you would use to log into a WURclient computer or log in to get your WUR e-mail using Outlook Online (https://outlook.office365.com).
Create a mount point for the Windows share
For each Windows share you wish to mount during boot, you need to create a mount point.
For example I have created a mount point for my personal WUR Windows share (also known as the M:-drive
within WUR) under /mnt
as wur-m
. Creation of such a mount point is achieved with the following command:
sudo mkdir /mnt/wur-m
Add filesystems to /etc/fstab
The file /etc/fstab
contains descriptive information about the filesystems the system can mount. The file is only read by programs, and not written; it is your duty as system administrator to properly create and maintain this file.
Each filesystem is described on a separate line. Fields on each line are separated by tabs. Lines starting with #
are comments. Blank lines are ignored.
Retrieve user and group identifier
To properly mount a filesystem the values of the user (uid
) and group (gid
) identifiers are required. To retrieve the uid
and gid
values issue the following command in a terminal:
id localusername
Here localusername
should be your username on the Linux system.
In most Linux systems the first user will have uid=1000
and gid=1000
. Do not assume these values are the same for your system, always check with before mentioned command!
Open /etc/fstab
and add the filesystem
The file containing static information about the filesystems resides in /etc
and, therefore, can only be edited by the system administrator, also known as root.
Open /etc/fstab
with administrator (root) privileges in your favorite text editor, e.g. VIM, Emacs, nano or whatever editor you prefer. As an example here the command to open the /etc/fstab
file with xed
:
sudo xed /etc/fstab
Start on a new line below everything already present in the /etc/fstab
file.
To add your Personal WUR Windows share add the following line:
# WUR Personal M-drive
//fs01mixedsmb.wurnet.nl/DBL-STANDARD_HOMEDIR$/user001 /mnt/wur-m cifs credentials=/home/localusername/.smbpassword,user,uid=uidvalue,gid=gidvalue 0 0
- Make sure that there are tabs between each element in the line of the
/etc/fstab
file - Replace
user001
with your WUR username - Replace
localusername
with your username on the Linux system - Replace
uidvalue
andgidvalue
with the values obtained from theid
command as described above.
Retrieving the address of the filesystem to be mounted
The easiest way to retrieve the address of the WUR filesystem to be mounted is via File Explorer on a Windows WURclient. A Linux user can alternatively use VMWare Horizon client to log into a virtual Windows desktop. Perform the following steps:
- Open File Explorer
- Navigate in the left column to
dfs-root (\\wurnet.nl) (W:)
. - Locate the the folder you wish to mount as a filesystem in your Linux system, e.g. a project folder under
PROJECTS
. - Right-click the folder you wish to mount as a filesystem and open up the
Properties
. - Click the tab
DFS
and denote the path provided.
Convert the denoted path to be used in the /etc/fstab
file:
- Replace each
\
with a/
- Replace underscore characters in the folder name by
\137
(octal ascii code) - Replace whitspace characters in the folder name by
\040
(octal ascii code)
Examples
W:\PSG\_Data Exchange (PSG-wide)
becomes:
//fs01mixedsmb.wurnet.nl/DBL-STANDARD_PSG$/PSG~\137Data\040Exchange\040(PSG-wide)
W:\PSG\PSG Biometris
(also known as the BiometrisN:-drive
) becomes:
//fs01mixedsmb.wurnet.nl/DBL-STANDARD_PSG$/PSG~PSG\040Biometris
W:\PROJECTS\BiomDatasetsArchive
becomes
//fs02mixedsmb.wurnet.nl/TPE-STANDARD_PROJECTS$/PROJECTS~BiomEDatasetsArchive
W:\PROJECTS\Biom_ZeZhu
becomes
//fs02mixedsmb.wurnet.nl/TPE-STANDARD_PROJECTS$/PROJECTS~Biom\137ZeZhu
Mount a share after boot or setting up a VPN connection
When after booting your system a Windows share is not automatically mounted or you have set up a VPN connection to WURNET and want to mount a WUR Windows share from your /etc/fstab
file, this is done by issuing the following command:
# For example connect /mnt/wur-m after setting up a VPN connection
sudo mount /mnt/wur-m
To disconnect a WUR Windows share, for example prior to breaking of a VPN connection, issue the following command:
# For example disconnect /mnt/wur-m prior to breaking a VPN connection
sudo umount /mnt/wur-m