Contents

Persistent Research Drive Mount

System maintenance on the vm will cause it to occasionally reboot. This section outlines how to ensure the drive is automatically remounted after reboot.

set up a credentials file

Create a file in your home-directory of the vm named (e.g.) .cifs_credentials, and edit it to contain the lines

username=<your_UOA_username>
password=<your_UOA_password>
domain=UOA

Now protect that file by changing its permissions to give you, and no-one else, read-only access:

chmod 0600 ~/.cifs_credentials

Gather auxilliary information

Find your user identity on the vm with the command

id

and observe the values of your uid and gid (user-id and group-id).

We assume you mount the drive on your home directory as above, e.g. ~/<research_drive_mount_point>.

edit /etc/fstab with sudo

Using sudo, edit the file /etc/fstab and append the following line to it, substituting your values:

//files.auckland.ac.nz/research/<research_drive_name>  /home/<your_username_on_the_vm>/<research_drive_mount_point>  cifs credentials=/home/<your_username_on_the_vm>/.cifs_credentials,uid=<your_uid>,gid=<your_gid>,users 0   0

Unmount the research drive in order to test the fstab configuration:

sudo mount -av

Shared Research Drive Access

(Taken from RedHat documentation)

One method of sharing a mount of a research drive is by having an admin user set up the mount with the multiuser option, mounting the drive, and then letting individual users authenticate with cifs using their credentials.

Superuser setup

  1. A superuser creates the folder /mnt/ with group owner the vm's rw(user) group name:
mkdir -p /mnt/<research_drive_name>
chown <user>:<vm_rw_group_name> /mnt/<research_drive_name>

2.This superuser then creates a secure credentials file for their access to the research drive:

E.g. create the file //.smb.cred to contain the details:

user=<UOA_username>
password=<UOA_password>
domain=UOA
chmod 0600 /<some_directory_path>/.smb.cred
  1. With sudo permissions, edit the file /etc/fstab instructing that the research drive be mounted with these credentials, with the multiuser attribute:
//files.auckland.ac.nz/research/<research_drive_name>  /mnt/unifiles   cifs multiuser,sec=ntlmssp,credentials=/<some_directory_path>/.smb.cred,noauto  0 0
systemctl daemon-reload
  1. A superuser effectively mounts the drive under their username, supplying the credentials file to /etc/fstab.

User access

Any user of the vm who has access to the research-drive (belongs to the appropriate vmuser group) then provides their credentials for the research-drive server (files.auckland.ac.nz) to the kernel’s keyring with the command:

cifscreds add -u $USER files.auckland.ac.nz

They can then access the drive with their permissions in the directory /mnt/