NAME

nfssrv - NFS server, version 3

synopsis

nfssrv [ -c ] [ -d ] [ -D ] [ -s ] [ -h host ] [ -n nfsport ] [ -m mntport ] [ -p udp|tcp ] [ -t passwd group ] [ -S aname anameup mtpt mtptup rootqidpath ] styxfile

DESCRIPTION

Nfssrv is an NFSv3 server, it also serves the mount protocol. It exports files served by styxfile over NFS.

Nfssrv can operate in stateless and almost-stateless mode. In stateless mode (when -S is specified) all NFS file handles are mapped directly to the ``qid path'' of a file. In this case styxfile must be a special file server that allows file look ups by ``qid path''. See below for details. In almost-stateless mode, paths up to 63 bytes long are stateless, beyond that they are not. This can be problematic for clients that do not properly look up stale file handles.

Nfssrv only maps NFS uids and gids (integers) to styx uids and gids (strings) when -t has been specified. With -t it also executes NFS requests with the permissions of the user name (after translation from NFS uid). It does this by mounting the file system servec by styxfile once for each user that connects. Without -t all file operations are executed as the user that started nfssrv.

Since Styx does not support ``special files'', such as (sym)links or device nodes, operations involving such file types are not supported.

At startup, nfssrv registers itself with the portmapper through /chan/portmapper.

Options
-c
After NFS file operations such as ``read'' and ``write'', return the new attributes of the file, to let the client better implement ``weak cache consistency''.
-d
Print debug output.
-D
Print NFS message traces.
-s
Stay in foreground. By default nfssrv runs in the background after having claimed tcp & udp ports.
-h host
Listen on host. The default is ``*''.
-n nfsport
Listen on port nfsport for the NFS server, 2049 by default.
-m mntport
Listen on port mntport for the mnt service, 39422 by default.
-p udp|tcp
Listen only for the specified protocol, udp or tcp. Nfssrv listens for both protocols by default.
-t user group
Read the files user and group in common unix passwd and groups format and use it for mapping NFS uids and gids (integers) to styx uids and gids (strings). The styx user name (after translation from an NFS uid) is used in the styx attach message too, to enforce user permissions. If this option is not specified, styx names are all mapped to ``0'', and user id's are all mapped to ``none''.
-S aname anameup mtpt mtptup rootqidpath
Instead of mounting styxfile for normal files, mount it twice, once with attach specifier aname on mtpt and once with anameup on mtptup. Use these paths to open files by their ``qid path'' and looking up the parent of a ``qid path'' respectively. The file server behind styxfile must treat walks to hexadecimal numbers in its root directory as walks to the file with the ``qid path'' represented by that number. The root of the exported file system is represented by rootqidpath.

EXAMPLE

portmapper && nfssrv <>{export -a /}

SOURCE

/appl/cmd/nfssrv.b
/appl/lib/nfsrpc.m
/appl/lib/nfsrpc.b
/appl/lib/mntrpc.m
/appl/lib/mntrpc.b
/appl/lib/sunrpc.b
/module/sunrpc.m

SEE ALSO

portmapper(1),
RFC1813, ``NFS Version 3 Protocol'',
RFC1831, ``Remote Procedure Call Protocol Version 2'',
RFC4506, ``XDR: External Data Representation Standard''.

BUGS

Nfssrv does not try to be too smart. For example, it does not have a duplicate request cache.

nfssrv(1 ) Rev:  Sun Dec 13 13:58:49 GMT 2009