Before mapping a network drive on Linux, you must do the following:
- Execute all commands as root (typically by using sudo)
- Install either cifs-utils (Ubuntu) or cifs-mount (Fedora). If you are using a different Linux distribution, you must look for the CIFS package in your systems manual/package management.
In Ubuntu, you can install the package by running the following command in the terminal:
> sudo apt-get install cifs-utils
You now have two options for mapping a network drive:
- Map network drive in the terminal - this will create temporary access which is disconnected when the computer shuts down/restarts.
- Map network drive during startup - since the connection is automatically created during startup, this will create permanent access.
Regardless of your method of choice, the following parameters are referred to in the instructions:
USERNAME: all letters before @ in AAU username.
PASSWORD: the password associated with your email.
DEPARTMENT: if you are a staff member, this is the department in which you are employed, such as es, bio, hst, etc. Students simply type "student.aau.dk" after @.
MOUNT POINT: the directory to the shortcut you create.
SERVER: the name of the server that you want to access. This is either aau.dk or DEPARTMENT.aau.dk. Replace DEPARTMENT with the name of department you seek to access (such as, es, student, hst, etc.).
SHARE: the directory to the folder on the network drive which you seek to access.
VERS: security setting, samba version
MAP NETWORK DRIVE IN THE TERMINAL
- Start by creating the folder which is to act as the local shortcut to the network directory you wish to map, in other words, this is your MOUNT POINT:
> mkdir -p ~/mnt/NAME
NAME is your chosen folder name.
- You can now map the network drive using the following command:
> sudo mount.cifs //SERVER/SHARE MOUNTPOINT –o netuids,user=USERNAME,dom=DEPARTMENT,pass=PASSWORD,vers=2.1
If mount.cifs does not work, try using mount –t cifs instead (the outcome will be the same).
MAP NETWORK DRIVE DURING STARTUP
- Automatically mapping a network drive during startup requires you to manually configure the fstab file. You can open the file in a text editor using the following command (Ubuntu):
> sudo gedit /etc/fstab
- Then paste this command in a new line:
> //aau.dk/DEPARTMENT /media/DEPARTMENT.aau.dk cifs setuids,dom=DEPARTMENT,user=USERNAME,pass=PASSWORD
These changes require you to restart your computer.
WARNING: Changes made elsewhere in the file may cause for errors in the operating system. Therefore, you must be careful and double-check that any changes made in the file is made in accordance with this guide.
REMOTE ACCESS TO NETWORK DRIVE
You can disconnect the access to the network drive at any time by using the following command:
> sudo umount /MOUNTPOINT