LXC - HDD USB mount point permissions

LeidenSpain

New Member
Sep 9, 2022
18
0
1
Spain
Hi,

I have mounted an exFat USB drive to the PROXMOX host, using an fstab mount:
Code:
/dev/sdb1/media/USB1 exfat defaults,uid=0,gid=0 0 0
which I have all the permissions to be able to use it as root:
Code:
root@server:/media/USB1# ls -l
total 48384
drwxr-xr-x 2 root root   131072 Oct  9 10:45 'New Folder'
drwxr-xr-x 6 root root   131072 Apr 11  2022  Test
drwxr-xr-x 6 root root   131072 Feb  8  2022  SERVER_Files
drwxr-xr-x 6 root root   131072 Feb  9  2022  SERVER_Media

Then, I have several LXCs mounted with privileges, and mount point to the USB disk, so I can use it directly.

My problem is that on one of the machines I want to mount a SAMBA server to share this hard drive, so that multiple users can use it.
The problem is with the permissions: only the root user has write permissions, the rest of the users can only read.
I have tried everything I have found but there is no way.
Code:
root@Almacenamiento:/media/USB1# ls -l
total 48384
drwxr-xr-x 2 root root   131072 oct  9 10:45 'Nwe Folder'
drwxr-xr-x 6 root root   131072 abr 11  2022  Test
drwxr-xr-x 6 root root   131072 feb  8  2022  SERVER_Files
drwxr-xr-x 6 root root   131072 feb  9  2022  SERVER_Media

The only thing I have not done is what is indicated in this tutorial, but it talks about writing permission in an unprivileged LXC with the LXC user.
https://pve.proxmox.com/wiki/Unprivileged_LXC_containers
But apart from not understanding how it would be done, would it give me something? Since they would continue to be users other than root.

I would be grateful if you could help me, if only to tell me that what I want to do is either not possible or very complicated.
But I've been fighting with this for weeks without getting any progress.

Thanks


The last option is for everyone to use root access, and that would work.
 
Its owned by root with 755 rights, so only the ower is allowed to write to it. Did you try to change the rights to something like 777 (chmod -R 777 /media/USB1) so everyone can write to it?
 
  • Like
Reactions: LeidenSpain
HI,

I've tried changing permissions on both the host and the LXC, to no avail:
SERVER-HOST
Code:
root@server:/media/USB1# chmod -R 777 /media/USB1
root@server:/media/USB1# ls -l
total 48384
drwxr-xr-x 2 root root   131072 Oct  9 10:45 'New Folder'
drwxr-xr-x 6 root root   131072 Apr 11  2022  Test
drwxr-xr-x 6 root root   131072 Feb  8  2022  SERVER_Files
drwxr-xr-x 6 root root   131072 Feb  9  2022  SERVER_Media

LXC
Code:
root@Almacenamiento:/media/USB1# chmod -R 777 /media/USB1
root@Almacenamiento:/media/USB1# ls -l
total 48384
drwxr-xr-x 2 root root   131072 oct  9 10:45 'New Folder'
drwxr-xr-x 6 root root   131072 abr 11  2022  Test
drwxr-xr-x 6 root root   131072 feb  8  2022  SERVER_Files
drwxr-xr-x 6 root root   131072 feb  9  2022  SERVER_Media
 
Did you try to mount is without the ",uid=0,gid=0"?
/dev/sdb1/media/USB1 exfat defaults, 0 0??

OK, I'll try and tell you

Nothing :confused:
Code:
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/pve/root / ext4 errors=remount-ro 0 1
UUID=9794-872D /boot/efi vfat defaults 0 1
/dev/pve/swap none swap sw 0 0
proc /proc proc defaults 0 0

/dev/sda    /backup    ext4    defaults    0    0
#/dev/sdb1   /media/USB1    exfat    rw    0    0
/dev/sdb1 /media/USB1 exfat defaults 0 0

Code:
root@server:/media/USB1# ls -l
total 48384
drwxr-xr-x 2 root root   131072 Oct  9 10:45 'New Folder'
drwxr-xr-x 6 root root   131072 Apr 11  2022  Test
drwxr-xr-x 6 root root   131072 Feb  8  2022  SERVER_Files
drwxr-xr-x 6 root root   131072 Feb  9  2022  SERVER_Media
 
Last edited:
Hi,


Just as I ask you when I have a problem, I think it's fair to report when I manage to solve it (and that it can help the rest of the community).

In the end I managed to mount the USB drive so that any user has permission to write to it.
Right now I have the LXC machines with privileges and it works perfectly with this setup:
Code:
/dev/sdb1 /media/USB1 exfat errors=remount-ro,rw,users,noatime,nodiratime,umask=0    0       2

Thanks everyone for your help.

I'll see you in another thread ;)
 
T
Hi,


Just as I ask you when I have a problem, I think it's fair to report when I manage to solve it (and that it can help the rest of the community).

In the end I managed to mount the USB drive so that any user has permission to write to it.
Right now I have the LXC machines with privileges and it works perfectly with this setup:
Code:
/dev/sdb1 /media/USB1 exfat errors=remount-ro,rw,users,noatime,nodiratime,umask=0    0       2

Thanks everyone for your help.

I'll see you in another thread ;)
This line also helped me in the same problem. Thnx
 
  • Like
Reactions: LeidenSpain