NFS(4) NFS(4) NAME nfs - Sun network file system client SYNOPSIS nfs [ -DRv ] [ -p perm ] [ -s srvname ] [ -u passwd group ] addr1 [ addr2 ] aux/portmap [ -R ] host cmd aux/nfsmount [ -R ] host cmd DESCRIPTION Nfs translates between the Sun network file system protocol (NFS) and 9P, allowing 9P clients to mount file systems on NFS servers. NFS servers comprise two separate services: a mount service used to obtain the initial file handle, and a file service used to perform actual file system operations. The Sun port mapper service is typically used to find these two services. If one address is given, it is taken to be the address of a port mapper service; nfs queries the port mapper to find the addresses of the NFS mount service and file service. If two addresses are given, the port mapper is bypassed; addr1 is used as the address of the NFS mount service, and addr2 is used as the address of the file ser- vice. The options are: -D print all 9P messages. -R print all NFS messages. -v print verbose information about session startup. -p perm set the posted service file to have mode perm, which is assumed to be octal; the default is 600. -s srvname post the service as /srv/srvname; the default is /srv/addr1. -u passwd group translate user and group names using the passwd and group files, which are in the traditional Unix format. The translation is used to present names for user and group in stat(5) and wstat messages. The translation is also used to choose the user and group credentials to present for a user. Without this option, users and groups are presented as decimal numbers, and everyone Page 1 Plan 9 (printed 11/18/24) NFS(4) NFS(4) attaches as uid -1 (nobody on most Unix systems). Portmap and nfsmount are test programs to perform port map- per and NFS mount RPCs. They are useful mainly to help debug problems with starting nfs itself. The -R option causes them to print all RPC messages sent and received. Portmap queries a Sun RPC portmap server, which maps integer (program, version, protocol) triples to port numbers. Pro- gram and version are Sun RPC defined, while protocol is typ- ically TCP (6) or UDP (17). The commands are: null a no-op dump print the entire map set prog vers proto port add an entry to (or replace an entry in) the map unset prog vers proto port remove an entry from the map getport prog vers proto look for an entry with prog, vers, proto in the map, and return the corresponding port The default command is dump. For running NFS over UDP, there must be an entry for the NFS v3 mount daemon (100005, 3, 17) and the NFS v3 server itself (100003, 3, 17). Nfsmount queries a Sun NFS mount server, which authenticates (ha!) connections and hands out file handles naming the root of an exported file system. This handle is used as the basis for a conversation with the NFS service daemon itself. The commands are: null a no-op export dump the export table; each line is a path followed by a list of machines or groups allowed to mount that path mnt path attempt to acquire a file handle for path. the request has user and group id 1001 and `gnot' as the system name. umnt path notify the mount daemon that a particular path is being unmounted by the requesting system umntall notify the mount daemon that all paths mounted by the Page 2 Plan 9 (printed 11/18/24) NFS(4) NFS(4) requesting system are being unmounted dump should also dump an export table, but typically does nothing EXAMPLE We use this in our /rc/bin/9fs script to mount all the home directories served by bopp: case bopp if(! test -f /srv/bopp) nfs -p 666 -u /lib/ndb/1127.passwd /lib/ndb/1127.group bopp unmount /n/bopp >[2]/dev/null for(i in u0 u1 u2 u3 u4 u5 u6 u7 u8 u9) mount -a /srv/bopp /n/bopp /$i SOURCE /sys/src/cmd/nfs.c /sys/src/libsunrpc SEE ALSO nfsserver(8), srv(4) BUGS The authentication employed by NFS is laughable. The server simply trusts the uid, gid, and group list presented by the client. Nfs speaks only NFS version 3. Older operating systems typ- ically have reasonable NFS version 2 servers but crash when serving version 3. Page 3 Plan 9 (printed 11/18/24)