VM and LXC mount CIFS problem. [SOLVED]

monsignore

Member
Jan 16, 2020
5
4
23
56
EDIT: [solved] see end of this post for the solution



Hello,

I'm installing Proxmox 6.1-5 to replace several servers, and enjoy the possibility of using LXC and virtualization.

Scénario :

One VM to offer fileserver services SMB/CIFS : OpenMediavault or Linux.
LXC Turnkey Centos 8 : to use docker.
Mint Cinnamo VM : to work
Other VM for services.


The scenario exclude the use of smb/cifs share mounted on Proxmox host that will link to LXC as cifs/smb share are provided by a VM hosted on proxmox.
The cifs/smb shares won't be available before OpenMediavault VM is up and running, making Proxmox mounts fail.
  • Mounting shares to Mint VM works successfully.
  • I try to connect LXC Turnkey Centos 8 to shares but I ain't achieve it.



Mint VM
To test the mount, I tried to mount SMB/CIFS share from Mint VM terminal to an existing Linux file server and it worked flawlessly.
To make the mount reboot proof I used it in fstab :

Code:
monsignore@monsignore-Standard-PC-i440FX-PIIX-1996:~/mnt$ sudo cat /etc/fstab
# /etc/fstab: static file system information.
......
//192.168.222/shared /home/monsignore/mnt cifs username=xxxxxxxxxxxxxx,password=xxxxxxxxxxxxx,rw,users,dir_mode=0777,file_mode=0777 0 0

Works with ReadWrite for everyone !!


LXCs:
I tried to mount the same share with fstab on Privilegied and UnPrivilegied LXC Turnkey Centos8.
I'm looged as root.


Privilegied Centos8 LXC
I tried x2 different mounts so I created x2 directories :
Code:
[root@CentosPrivilegied media]# ls -lan /media
total 16
drwxr-xr-x  4 0 0 4096 Jan 27 13:03 .
drwxr-xr-x 19 0 0 4096 Jan 27 06:53 ..
drwxr-xr-x  2 0 0 4096 Jan 26 11:46 shared1
drwxr-xr-x  2 0 0 4096 Jan 27 13:03 shared2
[root@CentosPrivilegied media]# ls -la /media
total 16
drwxr-xr-x  4 root root 4096 Jan 27 13:03 .
drwxr-xr-x 19 root root 4096 Jan 27 06:53 ..
drwxr-xr-x  2 root root 4096 Jan 26 11:46 shared1
drwxr-xr-x  2 root root 4096 Jan 27 13:03 shared2


Coresponding mounts in fstab:
Code:
[root@CentosPrivilegied media]# cat /etc/fstab
//192.168.1.222/shared /media/shared1 cifs username=xxxxxx,password=xxxxxx,rw,users,dir_mode=0777,file_mode=0777 0 0
//192.168.1.222/shared /media/shared2 cifs username=xxxxxx,password=xxxxxx,uid=0,gid=0,iocharset=utf8,noperm 0 0

Results:
Code:
[root@CentosPrivilegied media]# mount -a
mount: /media/shared1: permission denied.
mount: /media/shared2: permission denied.

None of the mounts works.




UnPrivilegied Centos8 LXC
I tried x2 different mounts so I created x2 directories :
Code:
[root@Docker-Centos media]# ls -lan /media
total 16
drwxr-xr-x  4 100000 100000 4096 Jan 27 13:09 .
drwxr-xr-x 19 100000 100000 4096 Jan 27 06:51 ..
drwxr-xr-x  2      0      0 4096 Jan 27 13:09 shared1
drwxr-xr-x  2      0      0 4096 Jan 27 13:09 shared2
[root@Docker-Centos media]# ls -la /media
total 16
drwxr-xr-x  4 100000 100000 4096 Jan 27 13:09 .
drwxr-xr-x 19 100000 100000 4096 Jan 27 06:51 ..
drwxr-xr-x  2 root   root   4096 Jan 27 13:09 shared1
drwxr-xr-x  2 root   root   4096 Jan 27 13:09 shared2


Corresponding mounts in fstab:
Code:
[root@CentosPrivilegied media]# cat /etc/fstab
//192.168.1.222/shared /media/shared1 cifs username=xxxxxxxxxxx,password=xxxxxxxxxxx,rw,users,dir_mode=0777,file_mode=0777 0 0
//192.168.1.222/shared /media/shared2 cifs username=xxxxxxxxxxx,password=xxxxxxxxxxx,uid=0,gid=0,iocharset=utf8,noperm 0 0

Results:
Code:
[root@Docker-Centos media]# mount -a
mount: only root can use "--all" option (effective UID is 100000)

None of the mountsworks.


I tried to integrate the gid uid in the fstab :

Code:
[root@CentosPrivilegied media]# cat /etc/fstab
//192.1681.222/shared /media/shared1 cifs username=xxxxxxxxxxx,password=xxxxxxxxxxx,uid=100000,gid=100000,iocharset=utf8,noperm 0 0
//192.1681.222/shared /media/shared2 cifs username=xxxxxxxxxxx,password=xxxxxxxxxxx,uid=101001,gid=101001,iocharset=utf8,noperm 0 0

Results
Code:
[root@Docker-Centos media]# mount -a
mount: only root can use "--all" option (effective UID is 100000)
But no mounts either.


Thanks in advance for your help.


EDIT : THE SOLUTION thanks to Wolfgang :


First you can mount CIFS shares in a LXC ONLY if it's Privilegied.
You MUST untick "Unprivilegied Container" when creating the LXC

Screenshot_4.jpg


After creation you start the LXC, you have to modify Feature in Proxmox/Your LXC Option/Feature: adding CIFS capability:

Screenshot_5.jpg





you log in as root/sudo and install cifs-util :

Code:
[root@Centos-Docker shared]# yum install cifs-utils

Once done edit the LXC's fstab :

Code:
[root@Centos-Docker shared]# vi /etc/fstab
//192.168.1.XXX/shared /media/shared cifs username=xxxxxxxxxxxxxx,password=xxxxxxxxxxxx,rw,users,dir_mode=0777,file_mode=0777 0 0

Mount the share on your LXC :

Code:
[root@Centos-Docker shared]# mount -a

And voilà !
Code:
[root@Centos-Docker shared]# mount |grep 222
//192.168.1.222/shared on /media/shared type cifs (rw,nosuid,nodev,noexec,relatime,vers=3.1.1,cache=strict,username=monsignore,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.1.222,file_mode=0777,dir_mode=0777,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1)
[root@Centos-Docker shared]#

You got a fully Read-Write share mounted on your LXC.


Once again a huge thanks for this product, and for the support team ! ;)
 
Last edited:
Hi,

There is a CIFS checkbox in the options Tab(section Features) what has to be used.
You can only use it with privileged containers.
 
  • Like
Reactions: monsignore
Hi,

There is a CIFS checkbox in the options Tab(section Features) what has to be used.
You can only use it with privileged containers.


@wolfgang
Is it easier to create a new privileged container or convert an unprivileged ?

Having some issues running this:

root@pve:/mnt/pve/Backups/dump# pct restore 1001 vzdump-lxc-1000-2020_09_02-11_49_01.tar.zst -ignore-unpack-errors 1 -unprivileged -storage Backups
400 Parameter verification failed.
storage: storage 'Backups' does not support container directories
pct restore <vmid> <ostemplate> [OPTIONS]
 
Is it easier to create a new privileged container or convert an unprivileged ?
The easiest way is to backup and restores as a privileged container, but hit takes time.
 
Hi guys, sorry to re bring this all up again but I 'm having an issue with this at the moment. I have all the above configured as described

-privileged container,
-cifs feature option checked,
-cifs-utils installed,
-mounts added to /etc/fstab

but I can not get the mount to persist after reboot. They mount perfectly fine and operate as they should as long as the container remains on but I have to mount -a after every reboot. I have been scouring the forums all day today to no avail, can someone set me straight?
 
  • Like
Reactions: alex-gee
Hi guys, sorry to re bring this all up again but I 'm having an issue with this at the moment. I have all the above configured as described

-privileged container,
-cifs feature option checked,
-cifs-utils installed,
-mounts added to /etc/fstab

but I can not get the mount to persist after reboot. They mount perfectly fine and operate as they should as long as the container remains on but I have to mount -a after every reboot. I have been scouring the forums all day today to no avail, can someone set me straight?
I'm new to Proxmox, but I managed to setup a homeserver with it. 1x VM for OMV (Fileserver) and 1x LXC (running Ubuntu with Plex Media Server). I have the exact same issue than BrentPn.
I tried to delay the startup of the Ubuntu LXC as I was thinking that OMV might need to be started up first, but no luck so far.

I also see a error message on the pve:
CIFS VFS: Error connecting to Socket. Aborting Operation
CIFS VFS: cifs_mount failed w/return code = -2

Any clues how to solve it (beside typing sudo mount -a after each reboot of the pve)?
 
I'm new to Proxmox, but I managed to setup a homeserver with it. 1x VM for OMV (Fileserver) and 1x LXC (running Ubuntu with Plex Media Server). I have the exact same issue than BrentPn.
I tried to delay the startup of the Ubuntu LXC as I was thinking that OMV might need to be started up first, but no luck so far.

I also see a error message on the pve:
CIFS VFS: Error connecting to Socket. Aborting Operation
CIFS VFS: cifs_mount failed w/return code = -2

Any clues how to solve it (beside typing sudo mount -a after each reboot of the pve)?
I can't actually give you any tips in particular, but I do run ubuntu LXC with emby and all what I did was an entry in /etc/fstab as:

//<server> <mount_point> cifs guest,uid=998,gid=998,forceuid,forcegid,iocharset=utf8 0 0

And I checked my config as it has only:

cat 1000.conf
arch: amd64
hostname: emby-vm
memory: 2048
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=5A:B3:94:AA:AA:ED,ip=dhcp,ip6=dhcp,type=veth
onboot: 1
ostype: ubuntu
rootfs: VMs:vm-1000-disk-0,size=40G
swap: 512

Hope some help :)
 
EDIT: [solved] see end of this post for the solution



Hello,

I'm installing Proxmox 6.1-5 to replace several servers, and enjoy the possibility of using LXC and virtualization.

Scénario :

One VM to offer fileserver services SMB/CIFS : OpenMediavault or Linux.
LXC Turnkey Centos 8 : to use docker.
Mint Cinnamo VM : to work
Other VM for services.


The scenario exclude the use of smb/cifs share mounted on Proxmox host that will link to LXC as cifs/smb share are provided by a VM hosted on proxmox.
The cifs/smb shares won't be available before OpenMediavault VM is up and running, making Proxmox mounts fail.
  • Mounting shares to Mint VM works successfully.
  • I try to connect LXC Turnkey Centos 8 to shares but I ain't achieve it.



Mint VM
To test the mount, I tried to mount SMB/CIFS share from Mint VM terminal to an existing Linux file server and it worked flawlessly.
To make the mount reboot proof I used it in fstab :

Code:
monsignore@monsignore-Standard-PC-i440FX-PIIX-1996:~/mnt$ sudo cat /etc/fstab
# /etc/fstab: static file system information.
......
//192.168.222/shared /home/monsignore/mnt cifs username=xxxxxxxxxxxxxx,password=xxxxxxxxxxxxx,rw,users,dir_mode=0777,file_mode=0777 0 0

Works with ReadWrite for everyone !!


LXCs:
I tried to mount the same share with fstab on Privilegied and UnPrivilegied LXC Turnkey Centos8.
I'm looged as root.


Privilegied Centos8 LXC
I tried x2 different mounts so I created x2 directories :
Code:
[root@CentosPrivilegied media]# ls -lan /media
total 16
drwxr-xr-x  4 0 0 4096 Jan 27 13:03 .
drwxr-xr-x 19 0 0 4096 Jan 27 06:53 ..
drwxr-xr-x  2 0 0 4096 Jan 26 11:46 shared1
drwxr-xr-x  2 0 0 4096 Jan 27 13:03 shared2
[root@CentosPrivilegied media]# ls -la /media
total 16
drwxr-xr-x  4 root root 4096 Jan 27 13:03 .
drwxr-xr-x 19 root root 4096 Jan 27 06:53 ..
drwxr-xr-x  2 root root 4096 Jan 26 11:46 shared1
drwxr-xr-x  2 root root 4096 Jan 27 13:03 shared2


Coresponding mounts in fstab:
Code:
[root@CentosPrivilegied media]# cat /etc/fstab
//192.168.1.222/shared /media/shared1 cifs username=xxxxxx,password=xxxxxx,rw,users,dir_mode=0777,file_mode=0777 0 0
//192.168.1.222/shared /media/shared2 cifs username=xxxxxx,password=xxxxxx,uid=0,gid=0,iocharset=utf8,noperm 0 0

Results:
Code:
[root@CentosPrivilegied media]# mount -a
mount: /media/shared1: permission denied.
mount: /media/shared2: permission denied.

None of the mounts works.




UnPrivilegied Centos8 LXC
I tried x2 different mounts so I created x2 directories :
Code:
[root@Docker-Centos media]# ls -lan /media
total 16
drwxr-xr-x  4 100000 100000 4096 Jan 27 13:09 .
drwxr-xr-x 19 100000 100000 4096 Jan 27 06:51 ..
drwxr-xr-x  2      0      0 4096 Jan 27 13:09 shared1
drwxr-xr-x  2      0      0 4096 Jan 27 13:09 shared2
[root@Docker-Centos media]# ls -la /media
total 16
drwxr-xr-x  4 100000 100000 4096 Jan 27 13:09 .
drwxr-xr-x 19 100000 100000 4096 Jan 27 06:51 ..
drwxr-xr-x  2 root   root   4096 Jan 27 13:09 shared1
drwxr-xr-x  2 root   root   4096 Jan 27 13:09 shared2


Corresponding mounts in fstab:
Code:
[root@CentosPrivilegied media]# cat /etc/fstab
//192.168.1.222/shared /media/shared1 cifs username=xxxxxxxxxxx,password=xxxxxxxxxxx,rw,users,dir_mode=0777,file_mode=0777 0 0
//192.168.1.222/shared /media/shared2 cifs username=xxxxxxxxxxx,password=xxxxxxxxxxx,uid=0,gid=0,iocharset=utf8,noperm 0 0

Results:
Code:
[root@Docker-Centos media]# mount -a
mount: only root can use "--all" option (effective UID is 100000)

None of the mountsworks.


I tried to integrate the gid uid in the fstab :

Code:
[root@CentosPrivilegied media]# cat /etc/fstab
//192.1681.222/shared /media/shared1 cifs username=xxxxxxxxxxx,password=xxxxxxxxxxx,uid=100000,gid=100000,iocharset=utf8,noperm 0 0
//192.1681.222/shared /media/shared2 cifs username=xxxxxxxxxxx,password=xxxxxxxxxxx,uid=101001,gid=101001,iocharset=utf8,noperm 0 0

Results
Code:
[root@Docker-Centos media]# mount -a
mount: only root can use "--all" option (effective UID is 100000)
But no mounts either.


Thanks in advance for your help.


EDIT : THE SOLUTION thanks to Wolfgang :


First you can mount CIFS shares in a LXC ONLY if it's Privilegied.
You MUST untick "Unprivilegied Container" when creating the LXC

View attachment 14471


After creation you start the LXC, you have to modify Feature in Proxmox/Your LXC Option/Feature: adding CIFS capability:

View attachment 14472





you log in as root/sudo and install cifs-util :

Code:
[root@Centos-Docker shared]# yum install cifs-utils

Once done edit the LXC's fstab :

Code:
[root@Centos-Docker shared]# vi /etc/fstab
//192.168.1.XXX/shared /media/shared cifs username=xxxxxxxxxxxxxx,password=xxxxxxxxxxxx,rw,users,dir_mode=0777,file_mode=0777 0 0

Mount the share on your LXC :

Code:
[root@Centos-Docker shared]# mount -a

And voilà !
Code:
[root@Centos-Docker shared]# mount |grep 222
//192.168.1.222/shared on /media/shared type cifs (rw,nosuid,nodev,noexec,relatime,vers=3.1.1,cache=strict,username=monsignore,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.1.222,file_mode=0777,dir_mode=0777,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1)
[root@Centos-Docker shared]#

You got a fully Read-Write share mounted on your LXC.


Once again a huge thanks for this product, and for the support team ! ;)
Funcionó, hacer todo en ese mismo orden!, muchas gracias por compartir
 
  • Like
Reactions: majorgear
Hi! I need some help to make these mounts reboot proof... what's the best way in my LXC2?

mount -vvv -t cifs -o username=frigate,password=nono,domain=WORKGROUP //192.168.1.100/frigate/clips /shared/frigate/clips

mount -vvv -t cifs -o username=frigate,password=nono,domain=WORKGROUP //192.168.1.100/frigate/recordings /shared/frigate/recordings

mount -vvv -t cifs -o username=frigate,password=nono,domain=WORKGROUP //192.168.1.100/frigate/config /shared/frigate/config

Edit: I think I need baby steps help... do this-do-that :)
 
You can add them to the LXCs /etc/fstab. Something like: //192.168.1.100/frigate/clips /shared/frigate/clips /shared/frigate/clips cifs username=frigate,password=nono,domain=WORKGROUP 0 0.
 
You can add them to the LXCs /etc/fstab. Something like: //192.168.1.100/frigate/clips /shared/frigate/clips /shared/frigate/clips cifs username=frigate,password=nono,domain=WORKGROUP 0 0.
Thank you, I had that before but I am struggling with the correct format I think. Is there double
Code:
/shared/frigate/clips
in your line? Why?

I had before - but that was splitted later by 3 separate shares on advise of the frigate guys.
//192.168.1.100/frigate/ /shared/frigate/ cifs username=frigate,password=nono,rw,users,dir_mode=0777,file_mode=0777 0 0

how's above different/better/worse than yours? What is the 0777 stuff for?

I appreciate all help and realize I am sort of asking for a linux command crash cource, sorry if that is not suitable but I really would need the help.
 
Last edited:
The "/shared/frigate/clips" is where to mount the share "//192.168.1.100/frigate/clips" inside your LXC.

The "dir_mode=0777,file_mode=0777" you can locally/temporarily overwrite the rights of the shared data so everyone can read/write/execute that data no matter what rights the files/folders requires on the SMB server.
 
Sorry, in your example:
//192.168.1.100/frigate/clips /shared/frigate/clips /shared/frigate/clips cifs username=frigate,password=nono,domain=WORKGROUP 0 0

this:
/shared/frigate/clips /shared/frigate/clips
is in double. Is that an error?
 
Oh, sorry. You are right. Should be:
Code:
//192.168.1.100/frigate/clips /shared/frigate/clips   cifs   username=frigate,password=nono,domain=WORKGROUP   0   0
 
So, some final help here. do I need to go from this:
mount -vvv -t cifs -o username=frigate,password=nono,domain=WORKGROUP //192.168.1.100/frigate/clips /shared/frigate/clips
mount -vvv -t cifs -o username=frigate,password=nono,domain=WORKGROUP //192.168.1.100/frigate/recordings /shared/frigate/recordings
mount -vvv -t cifs -o username=frigate,password=nono,domain=WORKGROUP //192.168.1.100/frigate/config /shared/frigate/config

to this (in /etc/fstab in my LXC):
//192.168.1.100/frigate/clips /shared/frigate/clips cifs username=frigate,password=nono,domain=WORKGROUP,rw,users,dir_mode=0777,file_mode=0777 0 0
//192.168.1.100/frigate/recordings /shared/frigate/recordings cifs username=frigate,password=nono,domain=WORKGROUP,rw,users,dir_mode=0777,file_mode=0777 0 0
//192.168.1.100/frigate/config /shared/frigate/config cifs username=frigate,password=nono,domain=WORKGROUP,rw,users,dir_mode=0777,file_mode=0777 0 0
 
You can do it that way but thats not how you manually mounted it. If you want to try it out first by manually mounting you could run:
Code:
mount -vvv -t cifs -o username=frigate,password=nono,domain=WORKGROUP,rw,users,dir_mode=0777,file_mode=0777 //192.168.1.100/frigate/clips /shared/frigate/clips
mount -vvv -t cifs -o username=frigate,password=nono,domain=WORKGROUP,rw,users,dir_mode=0777,file_mode=0777 //192.168.1.100/frigate/recordings /shared/frigate/recordings
mount -vvv -t cifs -o username=frigate,password=nono,domain=WORKGROUP,rw,users,dir_mode=0777,file_mode=0777 //192.168.1.100/frigate/config /shared/frigate/config
 
EDIT: [solved] see end of this post for the solution



Hello,

I'm installing Proxmox 6.1-5 to replace several servers, and enjoy the possibility of using LXC and virtualization.

Scénario :

One VM to offer fileserver services SMB/CIFS : OpenMediavault or Linux.
LXC Turnkey Centos 8 : to use docker.
Mint Cinnamo VM : to work
Other VM for services.


The scenario exclude the use of smb/cifs share mounted on Proxmox host that will link to LXC as cifs/smb share are provided by a VM hosted on proxmox.
The cifs/smb shares won't be available before OpenMediavault VM is up and running, making Proxmox mounts fail.
  • Mounting shares to Mint VM works successfully.
  • I try to connect LXC Turnkey Centos 8 to shares but I ain't achieve it.



Mint VM
To test the mount, I tried to mount SMB/CIFS share from Mint VM terminal to an existing Linux file server and it worked flawlessly.
To make the mount reboot proof I used it in fstab :

Code:
monsignore@monsignore-Standard-PC-i440FX-PIIX-1996:~/mnt$ sudo cat /etc/fstab
# /etc/fstab: static file system information.
......
//192.168.222/shared /home/monsignore/mnt cifs username=xxxxxxxxxxxxxx,password=xxxxxxxxxxxxx,rw,users,dir_mode=0777,file_mode=0777 0 0

Works with ReadWrite for everyone !!


LXCs:
I tried to mount the same share with fstab on Privilegied and UnPrivilegied LXC Turnkey Centos8.
I'm looged as root.


Privilegied Centos8 LXC
I tried x2 different mounts so I created x2 directories :
Code:
[root@CentosPrivilegied media]# ls -lan /media
total 16
drwxr-xr-x  4 0 0 4096 Jan 27 13:03 .
drwxr-xr-x 19 0 0 4096 Jan 27 06:53 ..
drwxr-xr-x  2 0 0 4096 Jan 26 11:46 shared1
drwxr-xr-x  2 0 0 4096 Jan 27 13:03 shared2
[root@CentosPrivilegied media]# ls -la /media
total 16
drwxr-xr-x  4 root root 4096 Jan 27 13:03 .
drwxr-xr-x 19 root root 4096 Jan 27 06:53 ..
drwxr-xr-x  2 root root 4096 Jan 26 11:46 shared1
drwxr-xr-x  2 root root 4096 Jan 27 13:03 shared2


Coresponding mounts in fstab:
Code:
[root@CentosPrivilegied media]# cat /etc/fstab
//192.168.1.222/shared /media/shared1 cifs username=xxxxxx,password=xxxxxx,rw,users,dir_mode=0777,file_mode=0777 0 0
//192.168.1.222/shared /media/shared2 cifs username=xxxxxx,password=xxxxxx,uid=0,gid=0,iocharset=utf8,noperm 0 0

Results:
Code:
[root@CentosPrivilegied media]# mount -a
mount: /media/shared1: permission denied.
mount: /media/shared2: permission denied.

None of the mounts works.




UnPrivilegied Centos8 LXC
I tried x2 different mounts so I created x2 directories :
Code:
[root@Docker-Centos media]# ls -lan /media
total 16
drwxr-xr-x  4 100000 100000 4096 Jan 27 13:09 .
drwxr-xr-x 19 100000 100000 4096 Jan 27 06:51 ..
drwxr-xr-x  2      0      0 4096 Jan 27 13:09 shared1
drwxr-xr-x  2      0      0 4096 Jan 27 13:09 shared2
[root@Docker-Centos media]# ls -la /media
total 16
drwxr-xr-x  4 100000 100000 4096 Jan 27 13:09 .
drwxr-xr-x 19 100000 100000 4096 Jan 27 06:51 ..
drwxr-xr-x  2 root   root   4096 Jan 27 13:09 shared1
drwxr-xr-x  2 root   root   4096 Jan 27 13:09 shared2


Corresponding mounts in fstab:
Code:
[root@CentosPrivilegied media]# cat /etc/fstab
//192.168.1.222/shared /media/shared1 cifs username=xxxxxxxxxxx,password=xxxxxxxxxxx,rw,users,dir_mode=0777,file_mode=0777 0 0
//192.168.1.222/shared /media/shared2 cifs username=xxxxxxxxxxx,password=xxxxxxxxxxx,uid=0,gid=0,iocharset=utf8,noperm 0 0

Results:
Code:
[root@Docker-Centos media]# mount -a
mount: only root can use "--all" option (effective UID is 100000)

None of the mountsworks.


I tried to integrate the gid uid in the fstab :

Code:
[root@CentosPrivilegied media]# cat /etc/fstab
//192.1681.222/shared /media/shared1 cifs username=xxxxxxxxxxx,password=xxxxxxxxxxx,uid=100000,gid=100000,iocharset=utf8,noperm 0 0
//192.1681.222/shared /media/shared2 cifs username=xxxxxxxxxxx,password=xxxxxxxxxxx,uid=101001,gid=101001,iocharset=utf8,noperm 0 0

Results
Code:
[root@Docker-Centos media]# mount -a
mount: only root can use "--all" option (effective UID is 100000)
But no mounts either.


Thanks in advance for your help.


EDIT : THE SOLUTION thanks to Wolfgang :


First you can mount CIFS shares in a LXC ONLY if it's Privilegied.
You MUST untick "Unprivilegied Container" when creating the LXC

View attachment 14471


After creation you start the LXC, you have to modify Feature in Proxmox/Your LXC Option/Feature: adding CIFS capability:

View attachment 14472





you log in as root/sudo and install cifs-util :

Code:
[root@Centos-Docker shared]# yum install cifs-utils

Once done edit the LXC's fstab :

Code:
[root@Centos-Docker shared]# vi /etc/fstab
//192.168.1.XXX/shared /media/shared cifs username=xxxxxxxxxxxxxx,password=xxxxxxxxxxxx,rw,users,dir_mode=0777,file_mode=0777 0 0

Mount the share on your LXC :

Code:
[root@Centos-Docker shared]# mount -a

And voilà !
Code:
[root@Centos-Docker shared]# mount |grep 222
//192.168.1.222/shared on /media/shared type cifs (rw,nosuid,nodev,noexec,relatime,vers=3.1.1,cache=strict,username=monsignore,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.1.222,file_mode=0777,dir_mode=0777,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1)
[root@Centos-Docker shared]#

You got a fully Read-Write share mounted on your LXC.


Once again a huge thanks for this product, and for the support team ! ;)
I made an account just to comment and say thank you! Having spent the entire weekend struggling and not finding any solution that actually worked! Thank you so much for sharing!!!
 
  • Like
Reactions: Dunuin

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!