Mounting/Connecting SMB automatically from unprivileged LXC without using fstab

Sandbo

Well-Known Member
Jul 4, 2019
85
10
48
34
I am trying to connect to an SMB existing in another Proxmox guest, from both LXCs and VMs.

The LXC clients are unprivileged, and when I add
Code:
//192.168.11.20/store /mnt/store_mnt cifs username=store,password=password,_netdev 0 0
and execute
Code:
mount -a
It complained with an error suggesting a permission issue.
My understanding is that I cannot mount through fstab under an unprivileged LXC.
Trying to do the same under a VM works well.

However, I got confused as I can actually connect to the network drive if I connect manually within the GUI of the LXC.
For example, I can connect to the same network location and access the files if I add the above location from within the file manager (xfce).
As this is all I need, is it possible to do this step automatically on boot for the LXC, so other program can access the network location like it was mounted?

Update: It looks like I indeed do not have write access even after I have mounted the drive through the GUI. I guess this does not really solve my problem.
 
Last edited:
Have you tried to moun the network share on the PVE host and use a bind mount to make it accessible inside the container? Though user permissions might need to be handled if it is an unprivileged container.
 
Have you tried to moun the network share on the PVE host and use a bind mount to make it accessible inside the container? Though user permissions might need to be handled if it is an unprivileged container.
Thanks for the suggestion, that's actually the approach I have taken at the end.
Yes I am using unprivileged LXC, and I found that data written by one LXC can only be read but not written by the other.
As you mentioned, I might need to set the uid/gid, but if I just want data written by one LXC to be read/write-able by other LXCs, is there something simple (and likely less secure) I can do?

This might be ok for our use case.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!