I have a samba share that mounts just fine under the Ubuntu 12.04 host:
root:~# mount -t cifs -o credentials=/var/lib/lxc/vpn/rootfs/etc/samba/desktop.credentials //desktop/Media /media/Media
But when I try to do the same mount in an LXC container, also Ubuntu 12.04, which also has the cifs-utils
package installed, I get a permission error:
root:~# mount -t cifs -o credentials=/etc/samba/desktop.credentials //desktop/Media /media/Media
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Both commands are being run as root. Why would this be different in the container and is there a way I can get this mount to work under the container.
Best Answer
Direct mounting is not possible, you should mount the share to the host first and then use
lxc.mount.entry
configuration directive to bind mount share's mountpoint inside the container (an example of usinglxc.mount.entry
can be found here). You can also provide the container with an external fstab file as shown here.