2

I recently changed my home server setup from a basic Ubuntu Server installation running everything to a virtualised environment. I am currently running ProxMox type 1 hypervisor, with several VM's. Most of my services are run in Linux Containers (LXC), some of these services need access to a shared dataset. In order to provide access to the shared data set, I passed the data HDD through to a VM and then setup NFS exports. The LXC's then mount the NFS shares. However I am constantly coming across user permissions errors from different services. How can I easily manage these permissions across multiple LXC's without just setting everything to 777`.

UPDATE

Example of export:

/mnt/data/www 192.168.0.0/24(rw,async,no_root_squash,no_subtree_check,insecure)

Example of mount in fstab:

192.168.0.254:/mnt/data/www /mnt/www nfs auto,x-systemd.automount,soft,rsize=16384,wsize=16384,timeo=14,intr    0      0

The errors are in the form of permissions denied, as one LXC may create a file under the user www-data, but another LXC cannot access the file as it shows up as being owned by MySQL, I understand this is because of mismatching UID's, but I can't figure out how to solve the problem.

2
  • 2
    Post the details of your NFS exports along with the errors you're getting. Without that, it's impossible to say how you should manage your permissions. Commented Feb 3, 2016 at 14:53
  • I have updated the original post. I will add specific permissions issue errors later as I cannot access them at the moment from my mobile.
    – Craig Lowe
    Commented Feb 3, 2016 at 15:01

2 Answers 2

2

If you use NFS v4 you can map UIDs. Otherwise, you need to make sure that user and group IDs are consistent across all your VMs.

1

you need some form of UID mapping for NFS. Simple example is to use NIS, or better yet, something more modern like LDAP. Then your user IDS are coming from an authoritative source and NFS will correctly map permissions across the nodes. All of your nodes need to be members of the same authentication domain here.

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 8, 2023 at 0:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .