Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 5 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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