Quick start
1. Install
dotnet add package Fungusware.Nfs
2. Connect and use
using Fungusware.Nfs;
NfsLicense.Register("FNFS1...."); // your license key, once at start-up
await using var nfs = await NfsClient.ConnectAsync(new NfsClientOptions
{
Host = "192.168.1.20",
ExportPath = "/volume1/shared", // an exported directory on the server
UserId = 1000, // the Unix user the server should treat you as
GroupId = 1000,
});
foreach (var entry in await nfs.ListAsync("/photos"))
Console.WriteLine($"{entry.Name} {(entry.IsDirectory ? "<dir>" : entry.Attributes.Size + " bytes")}");
byte[] data = await nfs.ReadAllBytesAsync("/photos/cat.jpg");
await nfs.CreateDirectoryAsync("/backup/2026/10");
await nfs.WriteAllBytesAsync("/backup/2026/10/cat.jpg", data);
await nfs.MoveAsync("/backup/2026/10/cat.jpg", "/backup/cat.jpg", overwrite: true);
await nfs.DeleteDirectoryAsync("/backup/2026", recursive: true);
3. Give the library your key
Any one of these, checked in this order:
NfsClientOptions.LicenseKeyNfsLicense.Register(key)once at start-up- The
FUNGUSWARE_NFS_LICENSEenvironment variable
Without a valid key the library works fully, but each connection waits 10 seconds. That is fine for trying it out and not for production.
If the server refuses you
- The server must export the directory to your client address, and the Unix user in
UserIdmust have access. - Linux servers export with the
secureoption by default. If connecting fails with an access error, setUseSecurePort = true. - If only port 2049 is open, use NFSv4 (
Version = NfsProtocolVersion.V4), or for NFSv3 setNfsPortandMountPort.
NFS versions
Version defaults to Auto: NFSv4.1, then 4.0, then 3, whichever the server offers first.
NfsClient.ProtocolVersion shows which one is in use. Set V3, V4, V40 or
V41 to insist on one. Your code is the same for every version. NFSv4 uses one connection to port 2049 and no
portmapper or MOUNT.
The full reference is in the README that ships inside the package.