#!/usr/bin/bash set -eu # if less than one arguments supplied, display usage if [[ $# -ne 1 ]]; then echo "This script takes as input the name of the VM " >&2 echo "Usage: $0 vm_name" >&2 exit 1 fi VM_NAME="$1" ## Make sure VMs can read the base directory: chgrp 1010 "/lmn/media/${SUDO_USER}" chmod 0775 "/lmn/media/${SUDO_USER}" systemctl start virtiofs@${VM_NAME}-clone:${SUDO_USER}.service