# NFS server in a jail



## balanga (Jun 4, 2021)

Can I run an NFS server in a jail. I tried starting nfsd and got:-



> sysctl: vfs.nfsd.nfs_privport=0: Operation not permitted
> NFSv4 is disabled
> sysctl: vfs.nfsd.server_max_nfsvers=3: Operation not permitted


Is this just a configuration issue, or am I trying to do something that I can't?


----------



## SirDice (Jun 4, 2021)

You can't change kernel parameters from within a jail. That said, it should be possible to run an NFS server in a jail nowadays. You're going to need to configure it so the various parts bind to the IP address of the jail specifically though.


----------



## zirias@ (Jun 4, 2021)

This solution is kind of "fake" though. The NFS server is implemented in the kernel, so it isn't really "jailed". Or did I miss some newer alternative?

I personally use DNAT to allow access to _only_ NFS on my host machine and make it appear as if it was on the same jail as other file services…


----------

