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.


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 using lxc.mount.entry can be found here). You can also provide the container with an external fstab file as shown here.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.