Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 4 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
add comment

Your Answer

 
discard

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.