Securely access remote files by mounting NFS share to an unprivileged LXC. Our LXC/LXD Support team is ready to assist you.
Guide to Mounting NFS Share to an Unprivileged LXC Container
Network File System (NFS) is a distributed file system protocol that allows users to access files on remote servers as if they were stored locally. Built on the Open Network Computing Remote Procedure Call (ONC RPC) system, NFS is an open standard defined through RFCs, enabling broad implementation. It is widely used in Linux and Unix environments for efficient and reliable network file sharing.
NFS Characteristics
NFS offers centralized storage, cross-platform compatibility, efficient data transfer, and strong security. It allows users to access remote files as if they were local.
- Centralized Storage: Reduces redundancy, simplifies management, and ensures consistent access to up-to-date data.
- Cross-Platform Compatibility: Supports Linux, UNIX, macOS, and Windows, enabling seamless file sharing in mixed environments.
- Efficient Data Transfer: Uses caching, larger transfer sizes, and optimized RPCs to reduce network overhead and improve performance.
- Security Measures: Provides strong authentication with Kerberos, granular access controls, and best practices like host restrictions and firewalls to secure data.
This setup is especially useful when configuring LXC autostart unprivileged containers to automatically access shared NFS storage on boot.
Unprivileged LXC Containers
Unprivileged LXC containers use kernel user namespaces, mapping container UIDs and GIDs to different ranges on the host. For example, container root (UID 0) may map to UID 100000 on the host. This ensures that even if a container is compromised, security impact is limited to unprivileged users, making these containers safe by design.
They function like privileged containers but operate with mapped IDs for enhanced security.
Need Help with NFS or LXC?

Mounting NFS Share to an Unprivileged LXC
Mounting NFS shares on unprivileged LXC containers can be approached in several ways. Below are three common options:
Option 1: Using Proxmox GUI
Add the NFS share to your Proxmox datacenter and mount it to a privileged LXC with NFS enabled. While functional, Proxmox automatically creates folders based on content types, which may not suit all use cases. Using a privileged container is also less secure.
Option 2: SMB/CIFS Approach
Mounting via SMB/CIFS is straightforward but may perform poorly with workloads like torrenting that involve many small files. SMB is not optimized for parallel or small-file access, making this approach less suitable for high-performance tasks.
Option 3: Manual NFS Mount (Recommended)
This method mounts the NFS share directly without the Proxmox GUI.
- Create a mount point on the host:
mkdir /mnt/computer2/downloads
- Edit fstab for automatic mounting:
nano /etc/fstab
192.168.1.20:/mnt/user/downloads/ /mnt/computer2/downloads nfs defaults 0 0
- Reload systemd and mount:
systemctl daemon-reload
mount -a
- Map the mount to the LXC:
nano /etc/pve/lxc/101.conf
mp0: /mnt/computer2/downloads/,mp=/downloads
- Adjust LXC user permissions:
groupadd -g 10000 lxc_shares
usermod -aG lxc_shares root
- Reboot LXC and verify: Create a file in the mount point and test deletion from another machine.
This method also works seamlessly if you LXC create a container from Snapshot to replicate configurations while keeping NFS mounts consistent.
This approach avoids extra folders, maintains full access, and delivers high performance for parallel file operations like torrenting.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
Mounting NFS share to an unprivileged LXC provides secure and efficient access to remote files. This approach ensures full functionality, high performance, and enhanced container security, making it an ideal solution for managing shared storage in Linux environments.
In brief, our Support Experts demonstrated how to fix the “554 5.7.1 : Relay access denied” error.
