EXPORTFS(4)EXPORTFS(4)
NAME
exportfs, srvfs – network file server plumbing
SYNOPSIS
exportfs
[
options
]
srvfs
[
-dR
]
[
-p
perm
]
[
-P
patternfile
] [
-e
exportprog
]
name
path
DESCRIPTION
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
cpu(1)
command or by a network listener process. An initial protocol
establishes a root directory for the exported name space.
The
connection to
exportfs
is then mounted, typically on
/mnt/term.
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.
The options are:
-A address
Use the network
address
to announce
aan(8)
connections,
if requested by the initial protocol.
-a
Authenticate the user with the
p9any
protocol before running the regular
exportfs
session; used when
exportfs
is invoked to handle an incoming network connection.
Exportfs
creates a new name space for each connection, using
/lib/namespace
by default (see
namespace(6)).
-B address
Dial
address,
authenticate as a
p9any
client, and then
serve that network connection.
Requires setting the root of the name space with
-r
or
-s.
The remote system should run
import
-B
to handle the call.
See
import(4)
for an example.
-d -f dbgfile
Log all 9P traffic to
dbgfile
(default
/tmp/exportdb).
-e ’enc auth’
Set the encryption and authentication algorithms to use for
encrypting the wire traffic (see
ssl(3)).
The defaults are
rc4_256
and
sha1.
-m msize
Set the maximum message size that
exportfs
should offer to send (see
version(5));
this helps tunneled
9P connections to avoid unnecessary fragmentation.
-N nsfile
Serve the name space described by
nsfile.
-n
Disallow mounts by user
none.
-P patternfile
Restrict the set of exported files.
Patternfile
contains one regular expression per line,
to be matched against path names
relative to the current working directory
and starting with
/.
For a file to be exported, all lines with a prefix
+
must match and all those with prefix
-
must not match.
-R
Make the served name space read only.
-r root
Bypass the initial protocol, serving the name space rooted at
root.
-S service
bypass the initial protocol, serving the result of mounting
service.
A separate mount is used for each
attach(5)
message,
to correctly handle servers in which each mount
corresponds to a different client
e.g.,(
rio(4)).
-s
equivalent to
-r
/;
kept for compatibility.
The
cpu
command uses
exportfs
to serve device files in the terminal. The
import(4)
command calls
exportfs
on a remote machine, permitting users to access arbitrary pieces of
name space on other systems.
Because the kernel disallows reads and writes on mounted pipes
(as might be found in
/srv),
exportfs
calls itself (with appropriate
-m
and
-S
options) to simulate reads and writes on such files.
Srvfs
invokes
exportprog
(default
/bin/exportfs)
to create a mountable file system from a name space
and posts it at
/srv/name,
which is created with mode
perm
(default 0600).
The name space is the directory tree rooted at
path.
The
-d,
-P,
and
-R
options, if present, are relayed to
exportprog.
EXAMPLES
To export the archive of one user for one month, except for secrets,
cd /n/dump
echo '+ ^/(2003(/10..(/usr(/glenda/?)?)?)?)?' > /tmp/pattern
echo '- \.(aes|pgp)$' >> /tmp/pattern
exportfs -P /tmp/pattern
Use
srvfs
to enable mounting of an FTP file system (see
ftpfs(4))
in several windows,
or to publish a
/proc
(see
proc(3))
with a broken process so a remote person may debug the program:
srvfs ftp /n/ftp
srvfs broke /mnt/term/proc
Use
srvfs
to obtain a copy of a service to be manipulated directly
by a user program like
nfsserver(8):
srvfs nfs.boot /srv/boot
aux/nfsserver -f /srv/nfs.boot
Use
srvfs
to spy on all accesses to a particular subtree:
srvfs -d spy /
tail -f /tmp/exportdb &
mount /srv/spy /n/spy
cd /n/spy; ls
SOURCE
/sys/src/cmd/exportfs
/sys/src/cmd/srvfs.c
SEE
dial(2),
import(4),
aan(8),
listen(8)