.TH EXPORTFS 4.SH NAMEexportfs, srvfs \- network file server plumbing.SH SYNOPSIS.B exportfs[.I options].PP.B srvfs[.B -dR][.B -p.I perm][.B -P.I patternfile] [.B -e.I exportprog].I name.I path.SH DESCRIPTION.I Exportfsis a user level file server that allows Plan 9 compute servers, ratherthan file servers, to export portions of a name space across networks.The service is started either by the.IR cpu (1)command or by a network listener process. An initial protocolestablishes a root directory for the exported name space.Theconnection to.I exportfsis then mounted, typically on.BR /mnt/term ..I Exportfsthen acts as a relay file server: operations in the imported filetree are executed on the remote server and the results returned. Thisgives the appearance of exporting a name space from a remote machineinto a local file tree..PPThe options are:.TF "-A \fIaddress".PD.TP.B -A \fIaddressUse the network.I addressto announce.IR aan (8)connections,if requested by the initial protocol..TP.B -aAuthenticate the user with the.I p9anyprotocol before running the regular.I exportfssession; used when .I exportfsis invoked to handle an incoming network connection..I Exportfscreates a new name space for each connection, using.B /lib/namespaceby default (see.IR namespace (6))..TP.B -B \fIaddressDial.IR address ,authenticate as a.I p9anyclient, and thenserve that network connection.Requires setting the root of the name space with .B -ror.BR -s .The remote system should run.B import.B -Bto handle the call.See.IR import (4)for an example..TP.B -d -f \fIdbgfileLog all 9P traffic to.I dbgfile(default.BR /tmp/exportdb )..TP.B -e '\fIenc auth\fL'Set the encryption and authentication algorithms to use forencrypting the wire traffic (see.IR ssl (3)).The defaults are.B rc4_256and.BR sha1 ..TP.B -m \fImsizeSet the maximum message size that .I exportfsshould offer to send (see.IR version (5));this helps tunneled9P connections to avoid unnecessary fragmentation..TP.B -N \fInsfileServe the name space described by.IR nsfile ..TP.B -nDisallow mounts by user.BR none ..TP.B -P \fIpatternfileRestrict the set of exported files..I Patternfilecontains one regular expression per line,to be matched against path namesrelative to the current working directoryand starting with.BR ./ .For a file to be exported, all lines with a prefix.B +must match and all those with prefix.B -must not match..TP.B -RMake the served name space read only..TP.B -r \fIrootBypass the initial protocol, serving the name space rooted at.IR root ..TP.B -S \fIservicebypass the initial protocol, serving the result of mounting.IR service .A separate mount is used for each.IR attach (5)message,to correctly handle servers in which each mountcorresponds to a different client.IR e.g. , (.IR rio (4))..TP.B -sequivalent to.B -r.BR / ;kept for compatibility..PD.PPThe.B cpucommand uses.I exportfsto serve device files in the terminal. The.IR import (4)command calls.I exportfson a remote machine, permitting users to access arbitrary pieces ofname space on other systems..PPBecause the kernel disallows reads and writes on mounted pipes(as might be found in.BR /srv ),.I exportfscalls itself (with appropriate.B -mand.B -S options) to simulate reads and writes on such files..PP.I Srvfsinvokes.I exportprog(default.BR /bin/exportfs )to create a mountable file system from a name spaceand posts it at.BI /srv/ name ,which is created with mode.I perm(default 0600).The name space is the directory tree rooted at .IR path .The.BR -d ,.BR -P ,and.B -Roptions, if present, are relayed to.IR exportprog ..SH EXAMPLESTo export the archive of one user for one month, except for secrets,.IP.EXcd /n/dumpecho '+ ^\e.(/2003(/10..(/usr(/glenda/?)?)?)?)?' > /tmp/patternecho '- \e.(aes|pgp)$' >> /tmp/patternexportfs -P /tmp/pattern.EE.LPUse.I srvfsto enable mounting of an FTP file system (see.IR ftpfs (4))in several windows, or to publish a.B /proc(see.IR proc (3))with a broken process so a remote person may debug the program:.IP.EXsrvfs ftp /n/ftpsrvfs broke /mnt/term/proc.EE.LPUse .I srvfsto obtain a copy of a service to be manipulated directlyby a user program like.IR nfsserver (8):.IP.EXsrvfs nfs.boot /srv/bootaux/nfsserver -f /srv/nfs.boot.EE.LPUse.I srvfsto spy on all accesses to a particular subtree:.IP.EXsrvfs -d spy /tail -f /tmp/exportdb &mount /srv/spy /n/spycd /n/spy; ls.EE.SH SOURCE.B /sys/src/cmd/exportfs.br.B /sys/src/cmd/srvfs.c.SH SEE ALSO.IR dial (2),.IR import (4),.IR aan (8),.IR listen (8)
.TH EXPORTFS 4
.SH NAME
exportfs, srvfs \- network file server plumbing
.SH SYNOPSIS
.B exportfs
[
.I options
]
.PP
.B srvfs
[
.B -dR
]
[
.B -p
.I perm
]
[
.B -P
.I patternfile
] [
.B -e
.I exportprog
]
.I name
.I path
.SH DESCRIPTION
.I Exportfs
is a user level file server that allows Plan 9 compute servers, rather
than file servers, to export portions of a name space across networks.
The service is started either by the
.IR cpu (1)
command or by a network listener process. An initial protocol
establishes a root directory for the exported name space.
The
connection to
.I exportfs
is then mounted, typically on
.BR /mnt/term .
.I Exportfs
then acts as a relay file server: operations in the imported file
tree are executed on the remote server and the results returned. This
gives the appearance of exporting a name space from a remote machine
into a local file tree.
.PP
The options are:
.TF "-A \fIaddress"
.PD
.TP
.B -A \fIaddress
Use the network
.I address
to announce
.IR aan (8)
connections,
if requested by the initial protocol.
.TP
.B -a
Authenticate the user with the
.I p9any
protocol before running the regular
.I exportfs
session; used when
.I exportfs
is invoked to handle an incoming network connection.
.I Exportfs
creates a new name space for each connection, using
.B /lib/namespace
by default (see
.IR namespace (6)).
.TP
.B -B \fIaddress
Dial
.IR address ,
authenticate as a
.I p9any
client, and then
serve that network connection.
Requires setting the root of the name space with
.B -r
or
.BR -s .
The remote system should run
.B import
.B -B
to handle the call.
See
.IR import (4)
for an example.
.TP
.B -d -f \fIdbgfile
Log all 9P traffic to
.I dbgfile
(default
.BR /tmp/exportdb ).
.TP
.B -e '\fIenc auth\fL'
Set the encryption and authentication algorithms to use for
encrypting the wire traffic (see
.IR ssl (3)).
The defaults are
.B rc4_256
and
.BR sha1 .
.TP
.B -m \fImsize
Set the maximum message size that
.I exportfs
should offer to send (see
.IR version (5));
this helps tunneled
9P connections to avoid unnecessary fragmentation.
.TP
.B -N \fInsfile
Serve the name space described by
.IR nsfile .
.TP
.B -n
Disallow mounts by user
.BR none .
.TP
.B -P \fIpatternfile
Restrict the set of exported files.
.I Patternfile
contains one regular expression per line,
to be matched against path names
relative to the current working directory
and starting with
.BR ./ .
For a file to be exported, all lines with a prefix
.B +
must match and all those with prefix
.B -
must not match.
.TP
.B -R
Make the served name space read only.
.TP
.B -r \fIroot
Bypass the initial protocol, serving the name space rooted at
.IR root .
.TP
.B -S \fIservice
bypass the initial protocol, serving the result of mounting
.IR service .
A separate mount is used for each
.IR attach (5)
message,
to correctly handle servers in which each mount
corresponds to a different client
.IR e.g. , (
.IR rio (4)).
.TP
.B -s
equivalent to
.B -r
.BR / ;
kept for compatibility.
.PD
.PP
The
.B cpu
command uses
.I exportfs
to serve device files in the terminal. The
.IR import (4)
command calls
.I exportfs
on a remote machine, permitting users to access arbitrary pieces of
name space on other systems.
.PP
Because the kernel disallows reads and writes on mounted pipes
(as might be found in
.BR /srv ),
.I exportfs
calls itself (with appropriate
.B -m
and
.B -S
options) to simulate reads and writes on such files.
.PP
.I Srvfs
invokes
.I exportprog
(default
.BR /bin/exportfs )
to create a mountable file system from a name space
and posts it at
.BI /srv/ name ,
which is created with mode
.I perm
(default 0600).
The name space is the directory tree rooted at
.IR path .
The
.BR -d ,
.BR -P ,
and
.B -R
options, if present, are relayed to
.IR exportprog .
.SH EXAMPLES
To export the archive of one user for one month, except for secrets,
.IP
.EX
cd /n/dump
echo '+ ^\e.(/2003(/10..(/usr(/glenda/?)?)?)?)?' > /tmp/pattern
echo '- \e.(aes|pgp)$' >> /tmp/pattern
exportfs -P /tmp/pattern
.EE
.LP
Use
.I srvfs
to enable mounting of an FTP file system (see
.IR ftpfs (4))
in several windows,
or to publish a
.B /proc
(see
.IR proc (3))
with a broken process so a remote person may debug the program:
.IP
.EX
srvfs ftp /n/ftp
srvfs broke /mnt/term/proc
.EE
.LP
Use
.I srvfs
to obtain a copy of a service to be manipulated directly
by a user program like
.IR nfsserver (8):
.IP
.EX
srvfs nfs.boot /srv/boot
aux/nfsserver -f /srv/nfs.boot
.EE
.LP
Use
.I srvfs
to spy on all accesses to a particular subtree:
.IP
.EX
srvfs -d spy /
tail -f /tmp/exportdb &
mount /srv/spy /n/spy
cd /n/spy; ls
.EE
.SH SOURCE
.B /sys/src/cmd/exportfs
.br
.B /sys/src/cmd/srvfs.c
.SH SEE ALSO
.IR dial (2),
.IR import (4),
.IR aan (8),
.IR listen (8)