Access samba share created in LXC container on mounted usb drive on the node

ObiDankenobi

New Member
Feb 6, 2023
4
0
1
Hi, since a couple of months I am using ProxMox and I enjoy it immensely.

Right now I have a VM with OpenMediaVault that is my Samba/NFS share server. My plan is to use the PVE host together with an LXC container as a file server and replace OMV.

I have the following setup:
  • On the proxmox node I have mounted a usb disk, mount folder "/mnt/pve/usb1/". I can mount it via /etc/fstab or a systemd mount makes no difference for my issue.
  • I have created a LXC container starting from Debian 11, the conf for that container is below
    Code:
    arch: amd64cores: 2
    features: nesting=1
    hostname: file-server-22
    memory: 512
    mp0: /mnt/pve/usb1/documents,mp=/mnt/usb-disk
    mp1: /home/dan/local_dir,mp=/mnt/pve-dir
    net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=EE:25:5E:FD:C8:A1,ip=dhcp,type=veth
    ostype: debian
    rootfs: local-lvm:vm-7022-disk-0,size=8G
    swap: 512
    unprivileged: 0
    lxc.idmap: u 0 100000 1000
    lxc.idmap: g 0 100000 1000
    lxc.idmap: u 1000 2201000 64000
    lxc.idmap: g 1000 2201000 64000
    lxc.idmap: u 65000 165000 536
    lxc.idmap: g 65000 165000 536
    As you can see I have 2 mounts to be able to test different scenarios: /mnt/usb-disk is on the host mounted usb drive and /mnt/pve-dir is a folder on the "normal" disk of the PVE host
  • I have installed Samba on the container and have the following config:

    Code:
    [global]
        workgroup = WORKGROUP
        log file = /var/log/samba/log.%m
        max log size = 1000
        logging = file
        panic action = /usr/share/samba/panic-action %d
        server role = standalone server
        obey pam restrictions = yes
        unix password sync = yes
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        pam password change = yes
        map to guest = bad user
        usershare allow guests = no
    
    [homes]
        comment = Home Directories
        browseable = no
        read only = yes
        create mask = 0700
        directory mask = 0700
        valid users = %S
    [local_folder_share]
        path = /mnt/documents
        guest ok = no
        guest only = no
        read only = no
        browseable = yes
        create mask = 0660
        force create mode = 0660
        directory mask = 0770
        force directory mode = 0770
        hide special files = yes
        follow symlinks = yes
        hide dot files = yes
        inherit acls = yes
        inherit permissions = yes
        force user = root
        force group = samba_users
        map acl inherit = yes
        acl_xattr:ignore system acls = yes
        vfs objects = acl_xattr
        #invalid users = dan1
        read list = @"samba_users"
        write list = @"samba_users"
        valid users = @"samba_users"
    
    [pve_folder_share]
        path = /mnt/pve-dir
        guest ok = no
        guest only = no
        read only = no
        browseable = yes
        inherit acls = no
        inherit permissions = no
        ea support = no
        store dos attributes = no
        printable = no
        create mask = 0664
        force create mode = 0664
        directory mask = 0775
        force directory mode = 0775
        hide special files = yes
        follow symlinks = yes
        hide dot files = yes
        force user = root
        force group = samba_users
        read list = @"samba_users"
        #write list = "dan1"
        valid users = @"samba_users"
    
    [mounted_folder_share]
        path = /mnt/usb-disk/documents
        guest ok = no
        guest only = no
        read only = no
        browseable = yes
        inherit acls = no
        inherit permissions = yes
        ea support = no
        store dos attributes = no
        printable = no
        create mask = 0664
        force create mode = 0664
        directory mask = 0775
        force directory mode = 0775
        hide special files = yes
        follow symlinks = yes
        hide dot files = yes
        valid users = @"samba_users"
        read list = @"samba_users"
        write list = "dan1"
  • I have a group called samba_users and a user dan1 that belongs to the samba_users and has it's samba password setup

My issue is : I cannot access the usb mounted share mounted_folder_share with any user from samba_users group (with 770 root:samba_users permissions on mounting point). I can access it with dan1 if I change the owner on disk to dan1 for instance (I do not want to do that). However for the other 2 shares (one on local disk of the LXC container and the other mount point from PVE disk), everything just works. I can access them, I can write (if user is in the write list and correct permissions are set).

What do I have to do to make it work with the USB drive? the whole point is to have the LXC container publish shares that are accessible by my kids, me , my wife. I cannot play the "owner" game as then if I am the owner, my wife cannot access the share etc.

Many thanks and sorry for the long post.
 
Last edited:
hi, the filesystem is ext4. Below is the result of fdisk -l /dev/sdc
Code:
Device     Start       End   Sectors   Size Type
/dev/sdc1   2048 500118158 500116111 238.5G Linux filesystem
 
and here the result of lsblk (regarding to sdc)
Code:
NAME                           MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdc                              8:32   0 238.5G  0 disk
└─sdc1                           8:33   0 238.5G  0 part /mnt/pve/usb1
 

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!