====== Proxmox - Guests (VMs and Containers) - Mount a Network Share in a Linux Container ====== How to mount a Network Share inside an Unprivileged (or Privileged) Linux Container (LXC) in Proxmox. **NOTE:** This is non-trivial because Unprivileged LXC Containers do not have the privileges available to directly mount network locations. The work around involves mounting the network share on the Container Host and then binding the mount folder on the host to a folder in the Container. * Unprivileged containers will only be able to **read** from Network Shares. * Privileged containers will be able to read from and write to Network Shares. * You cannot modify the Privilege of a container once it is made. * If can restore a container in either Privileged or Unprivileged mode, converting a container from Unprivileged to Privileged should be fairly straight forward. * The reverse isn't always true because there are files on a Privileged container that cannot exist on an Unprivileged container. ---- ===== Create the mount point directory ===== Log into the Container as root. mkdir /mnt/extfolder ---- ===== Log out of the container and stop the container ===== Use the GUI. ---- ===== Log into the Host Machine as root ===== **NOTE:** If necessary, create a credentials file with the username and password for the network share. * Remember to secure the file! Add the following lines to **/root/.credentials/my-credentials**. username=theusername password=thepassword workgroup=theworkgroup Save your changes. ---- ===== Set file permissions ===== chmod 600 /root/.credentials/my-credentials ---- ===== Create the target mount folder ===== mkdir /mnt/netfolder ---- ===== Edit fstab ===== Add a line to your fstab file to mount the network share: Add the following line to the bottom: //net/path/to/netfolder /mnt/netfolder cifs user,credentials=/root/.credentials/my-credentials,iocharset=utf8,noperm 0 0 ---- ===== Reload fstab ===== mount -a **NOTE:** The network share content should be visible at /mnt/netfolder. ---- ===== Bind the host directory to the container directory in the container config ===== Edit **/etc/pve/nodes/hostname/lxc/mycontainer.conf**. Add the following line after **memory** and before **net0**. mp0: /mnt/netfolder,mp=/mnt/extfolder ---- ===== Restart the client ===== **NOTE:** The network share should be accessible at /mnt/extfolder ---- ===== References ===== http://pve.proxmox.com/wiki/Unprivileged_LXC_containers