Run multiple instances of NFSv4 server on same host / proper use of NFS_CORE_PARAM NFS_Program
Hi, I am investigating the option of running nfs-ganesha in an unprivileged user/mount namespace on Linux, to export some directory only visible there, in addition to a main NFS server on the same host. It should be a simple world-readable share, no security considerations client-side. The machine hosts a regular NFS v3 and v4 service that should not be bothered with this task (and it cannot access the FUSE-based mount in the namespace that should be exported, and probably should not for containment/security reasons). I figured that it should be possible to run a NFSv4 server on a different TCP port than 2049, not needing further RPC port mapping. I tried this: NFS_CORE_PARAM { Protocols = 4; NFS_Port = 2050; Enable_UDP = false; Bind_addr = [some IP]; } NFS_KRB5 { Active_krb5 = false; } But soon realized that I am forced to specify additional values to make ganesha.nfsd even try to start, even if I don't need rquota, for example: NFS_CORE_PARAM { Rquota_Port = 8750; # even for nfsv4, ganesha insists on rpcbind?! NFS_Program = 200003; Rquota_Program = 200001; } I can of course not use the default NFS_Program value, as that is occupied by the main NFS instance. Well, at least I assume that from this error: 09/05/2026 18:00:53 : epoch 69ff5a35 : server : ganesha.nfsd-3213231[main] __Register_program :DISP :MAJ :Cannot register NFS V4 on TCP When I run with this setup, the client can contact ganesha, but errors out: client:/# mount -o nfsvers=4.2,proto=tcp,port=2050,ro server:/mount /mount mount.nfs: Protocol family not supported And I see this message in ganesha log with -N FULL_DEBUG: 09/05/2026 17:48:28 : epoch 69ff5747 : server : ganesha.nfsd-3207650[svc_6] nfs_rpc_noprog :DISP :F_DBG :Invalid Program number 100003 This suggests that I still do have a conflict with the RPC program 100003 … I am not that intimate with the details of the NFS protocol. The client does not need to RPC portmap, but the RPC stuff is still needed on the server and prevents multiple instances of NFS servers on one system? What is NFS_Program even for when client mount requests result in Program number 100003 being tried, anyway? Is there another trick I need to add to make this work? When I don't specify NFS_Program to a different value, the client gets mount.nfs: mounting server:/mount failed, reason given by server: No such file or directory I see 09/05/2026 18:03:48 : epoch 69ff5aaf : server : ganesha.nfsd-3214122[svc_2] nfs_rpc_process_request :DISP :DEBUG :Request from ::ffff:[client_ip] for Program 100003, Version 4, Function 1 has xid=1120240127 This seems to imply that the client hardcodes program 100003. I don't see an option for that in nfs(5). Could it be that a simple modification in mount.nfs to add an option for the RPC program to call would enable multiple instances of NFSv4 servers on one system, and that right now the presense of NFS_Program in ganesha config doesn't serve a purpose, at least with Linux kernel clients? Alrighty then, Thomas PS: I have this very setup running with Samba smbd in the namespace kistening on a non-standard port instead of NFS, wich works in principle, but the share needs to support file names with ':' in them, and POSIX semantics in general, so that I figured NFS would be the choice after all. The v9fs Linux client has some warnings to it regarding robustness that make me hesitate to switch to that protocol. -- Dr. Thomas Orgis HPC @ Universität Hamburg
Am Wed, 20 May 2026 12:05:27 +0200 schrieb "Dr. Thomas Orgis via Devel" <devel@lists.nfs-ganesha.org>:
I am investigating the option of running nfs-ganesha in an unprivileged user/mount namespace on Linux, to export some directory only visible there, in addition to a main NFS server on the same host. It should be a simple world-readable share, no security considerations client-side.
[…]
This seems to imply that the client hardcodes program 100003. I don't see an option for that in nfs(5). Could it be that a simple modification in mount.nfs to add an option for the RPC program to call would enable multiple instances of NFSv4 servers on one system, and that right now the presense of NFS_Program in ganesha config doesn't serve a purpose, at least with Linux kernel clients?
Anyone with a comment on that? Is it that strange to try to separate (say, containerize) NFS server instances with Ganesha? Am I in the wrong place for such user questions — the other mailing list seemingly dead? It looks like I'll not use NFS-Ganesha at all in the end, but it would be nice to have a confirmation about the technical reasons why the attempt to isolate NFS serving of a FUSE mount in a unprivileged namespace has to fail … or how it could work instead. Alrighty then, Thomas -- Dr. Thomas Orgis HPC @ Universität Hamburg
Dead-end conclusion follows … Am Thu, 28 May 2026 15:31:23 +0200 schrieb "Dr. Thomas Orgis via Devel" <devel@lists.nfs-ganesha.org>:
Am Wed, 20 May 2026 12:05:27 +0200 schrieb "Dr. Thomas Orgis via Devel" <devel@lists.nfs-ganesha.org>:
I am investigating the option of running nfs-ganesha in an unprivileged user/mount namespace on Linux, to export some directory only visible there, in addition to a main NFS server on the same host. It should be a simple world-readable share, no security considerations client-side.
[…]
It looks like I'll not use NFS-Ganesha at all in the end, but it would be nice to have a confirmation about the technical reasons why the attempt to isolate NFS serving of a FUSE mount in a unprivileged namespace has to fail … or how it could work instead.
I finally managed to come up with a config that _should_ work, but hits an roadblock that should have been obvious in retrospect: NFS_CORE_PARAM { Protocols = 4; NFS_Port = 2050; Enable_UDP = false; # Must configure a port for rquota or startup fails, cannot disable rquota. Rquota_Port = 8750; Rquota_Program = 200001; # Also, dbus registration fails without root, but no way to configure it out. } NFS_KRB5 { Active_krb5 = false; CCacheDir = /some/place/ganesha-ccache; } NFSv4 { RecoveryRoot = /some/placeganesha-var; } EXPORT { Export_Id = 0; Path = /srv/foo; Pseudo = /; Access_Type = RO; SecType = sys; Protocols = 4; FSAL { name = PSEUDO; } } EXPORT { Export_Id = 77; Path = /srv/foo/mount; Pseudo = /mount; Access_Type = RO; SecType = sys; Protocols = 4; FSAL { Name = VFS; } } This works … except that ganesha cannot get file handles: 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] vfs_open_by_handle :FSAL :DEBUG :Failed with Operation not permitted openflags 0x00000000 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] find_fd :FSAL :DEBUG :Failed with Operation not permitted openflags 0x00000020 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] fsal_common_is_referral :FSAL :EVENT :Failed to get attrs for referral, handle: 0x56328fcb8cf0, valid_mask: 0, request_mask: 82, supported: 0, error: Forbidden action 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] complete_op :NFS4 :DEBUG :Status of OP_GETFH in position 3 = NFS4_OK, op response size is 32 total response size is 128 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] process_one_op :NFS4 :DEBUG :Request 4: opcode 9 is OP_GETATTR 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] file_To_Fattr :NFS4 ACL :DEBUG :No permission check for ACL for obj 0x56328fcc0ef8 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] vfs_open_by_handle :FSAL :DEBUG :Failed with Operation not permitted openflags 0x00000000 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] find_fd :FSAL :DEBUG :Failed with Operation not permitted openflags 0x00000020 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] fsal_common_is_referral :FSAL :DEBUG :Checking attrs for referral, handle: 0x56328fcb8cf0, valid_mask: 0, request_mask: 82, supported: 0 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] vfs_open_by_handle :FSAL :DEBUG :Failed with Operation not permitted openflags 0x00000000 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] find_fd :FSAL :DEBUG :Failed with Operation not permitted openflags 0x00000020 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] fsal_common_is_referral :FSAL :EVENT :Failed to get attrs for referral, handle: 0x56328fcb8cf0, valid_mask: 0, request_mask: 82, supported: 0, error: Forbidden action 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] complete_op :NFS4 :DEBUG :Status of OP_GETATTR in position 4 = NFS4ERR_PERM, op response size is 4 total response size is 136 01/06/2026 11:38:41 : epoch 6a1d51c0 : server : ganesha.nfsd-895547[svc_13] complete_nfs4_compound :NFS4 :DEBUG :End status = NFS4ERR_PERM lastindex = 5 And, sure enough, reading up on the error on the first line leads me to https://github.com/nfs-ganesha/nfs-ganesha/wiki/VFS mentioning that ganesha needs CAP_DAC_READ_SEARCH, which is defined as CAP_DAC_READ_SEARCH - Bypass file read permission checks and directory read and execute permission checks; - invoke open_by_handle_at(2); - use the linkat(2) AT_EMPTY_PATH flag to create a link to a file referred to by a file descriptor. So … this kindof defeats the idea of running the NFS server as unprivileged user. It would indeed be interesting to know why open_by_handle_at() needs to be coupled with read permissions on EVERYTHING. It is really sad that there used to be a FUSE FSAL … which could have directly exposed the FUSE fs I am working with, without having to mount it one the server and having to play with namespaces to allow that at all. This would have been great! Sad that the FUSE FSAL had to go. I don't see me coding up a direct FSAL for the respective fs when it is already written to FUSE API. Or, to return to the VFS route … were there ever attempts to decouple open_by_handle_at() from the broad read permission on everything in Linux? So it will be a separate server with kernel NFS to get some separation of concerns for me, then … or a full-blown VM with one exported TCP port. Alrighty then, Thomas -- Dr. Thomas Orgis HPC @ Universität Hamburg
participants (1)
-
Dr. Thomas Orgis