Difference between revisions of "How to mount a Network Share in a Linux Container under Proxmox"
From steamWiki
(Created page with "This article describes how to mount a Network Share inside a Linux Container (LXC). This is non-trivial because LXC Containers do not have the privileges available to directl...") |
|||
Line 28: | Line 28: | ||
#*''mp0: /mnt/netfolder,mp=/mnt/extfolder'' | #*''mp0: /mnt/netfolder,mp=/mnt/extfolder'' | ||
#Restart the client and the network share should be accessible at ''/mnt/extfolder'' | #Restart the client and the network share should be accessible at ''/mnt/extfolder'' | ||
+ | |||
+ | [[Category: Linux]] |
Revision as of 21:35, 23 November 2018
This article describes how to mount a Network Share inside a Linux Container (LXC). This is non-trivial because 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.
- Log into your Container as root
- Create the a mount point directory
- mkdir /mnt/extfolder
- Log out of the container and stop the container
- Create the a mount point directory
- Log into your Host Machine as root
- if necessary, create a credentials file with the username and password for your network share. Then secure the file.
- nano /root/.credentials/my-credentials
- add the following lines
- username=theusername
- password=thepassword
- workgroup=theworkgroup
- Exit nano and save your changes
- Ctrl-X
- Y
- chmod 600
- create the target mount folder
- mkdir /mnt/netfolder
- Add a line to your fstab file to mount the network share
- nano /etc/fstab
- add the following line
- //net/path/to/netfolder /mnt/netfolder cifs user,credentials=/root/.credentials/my-credentials,iocharset=utf8,noperm 0 0
- Bind the host directory to the container directory in the container config
- nano /etc/pve/nodes/hostname/lxc/mycontainer.conf
- add the follow line after memory and before net0
- mp0: /mnt/netfolder,mp=/mnt/extfolder
- if necessary, create a credentials file with the username and password for your network share. Then secure the file.
- Restart the client and the network share should be accessible at /mnt/extfolder