exportfs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. .TH EXPORTFS 4
  2. .SH NAME
  3. exportfs, srvfs \- network file server plumbing
  4. .SH SYNOPSIS
  5. .B exportfs
  6. [
  7. .I options
  8. ]
  9. .PP
  10. .B srvfs
  11. [
  12. .B -dR
  13. ]
  14. [
  15. .B -p
  16. .I perm
  17. ]
  18. [
  19. .B -P
  20. .I patternfile
  21. ] [
  22. .B -e
  23. .I exportprog
  24. ]
  25. .I name
  26. .I path
  27. .SH DESCRIPTION
  28. .I Exportfs
  29. is a user level file server that allows Plan 9 compute servers, rather
  30. than file servers, to export portions of a name space across networks.
  31. The service is started either by the
  32. .IR cpu (1)
  33. command or by a network listener process. An initial protocol
  34. establishes a root directory for the exported name space.
  35. The
  36. connection to
  37. .I exportfs
  38. is then mounted, typically on
  39. .BR /mnt/term .
  40. .I Exportfs
  41. then acts as a relay file server: operations in the imported file
  42. tree are executed on the remote server and the results returned. This
  43. gives the appearance of exporting a name space from a remote machine
  44. into a local file tree.
  45. .PP
  46. The options are:
  47. .TF "-A \fIaddress"
  48. .PD
  49. .TP
  50. .B -A \fIaddress
  51. Use the network
  52. .I address
  53. to announce
  54. .IR aan (8)
  55. connections,
  56. if requested by the initial protocol.
  57. .TP
  58. .B -a
  59. Authenticate the user with the
  60. .I p9any
  61. protocol before running the regular
  62. .I exportfs
  63. session; used when
  64. .I exportfs
  65. is invoked to handle an incoming network connection.
  66. .I Exportfs
  67. creates a new name space for each connection, using
  68. .B /lib/namespace
  69. by default (see
  70. .IR namespace (6)).
  71. .TP
  72. .B -B \fIaddress
  73. Dial
  74. .IR address ,
  75. authenticate as a
  76. .I p9any
  77. client, and then
  78. serve that network connection.
  79. Requires setting the root of the name space with
  80. .B -r
  81. or
  82. .BR -s .
  83. The remote system should run
  84. .B import
  85. .B -B
  86. to handle the call.
  87. See
  88. .IR import (4)
  89. for an example.
  90. .TP
  91. .B -d -f \fIdbgfile
  92. Log all 9P traffic to
  93. .I dbgfile
  94. (default
  95. .BR /tmp/exportdb ).
  96. .TP
  97. .B -e '\fIenc auth\fL'
  98. Set the encryption and authentication algorithms to use for
  99. encrypting the wire traffic (see
  100. .IR ssl (3)).
  101. The defaults are
  102. .B rc4_256
  103. and
  104. .BR sha1 .
  105. .TP
  106. .B -m \fImsize
  107. Set the maximum message size that
  108. .I exportfs
  109. should offer to send (see
  110. .IR version (5));
  111. this helps tunneled
  112. 9P connections to avoid unnecessary fragmentation.
  113. .TP
  114. .B -N \fInsfile
  115. Serve the name space described by
  116. .IR nsfile .
  117. .TP
  118. .B -n
  119. Disallow mounts by user
  120. .BR none .
  121. .TP
  122. .B -P \fIpatternfile
  123. Restrict the set of exported files.
  124. .I Patternfile
  125. contains one regular expression per line,
  126. to be matched against path names
  127. relative to the current working directory
  128. and starting with
  129. .BR ./ .
  130. For a file to be exported, all lines with a prefix
  131. .B +
  132. must match and all those with prefix
  133. .B -
  134. must not match.
  135. .TP
  136. .B -R
  137. Make the served name space read only.
  138. .TP
  139. .B -r \fIroot
  140. Bypass the initial protocol, serving the name space rooted at
  141. .IR root .
  142. .TP
  143. .B -S \fIservice
  144. bypass the initial protocol, serving the result of mounting
  145. .IR service .
  146. A separate mount is used for each
  147. .IR attach (5)
  148. message,
  149. to correctly handle servers in which each mount
  150. corresponds to a different client
  151. .IR e.g. , (
  152. .IR rio (4)).
  153. .TP
  154. .B -s
  155. equivalent to
  156. .B -r
  157. .BR / ;
  158. kept for compatibility.
  159. .PD
  160. .PP
  161. The
  162. .B cpu
  163. command uses
  164. .I exportfs
  165. to serve device files in the terminal. The
  166. .IR import (4)
  167. command calls
  168. .I exportfs
  169. on a remote machine, permitting users to access arbitrary pieces of
  170. name space on other systems.
  171. .PP
  172. Because the kernel disallows reads and writes on mounted pipes
  173. (as might be found in
  174. .BR /srv ),
  175. .I exportfs
  176. calls itself (with appropriate
  177. .B -m
  178. and
  179. .B -S
  180. options) to simulate reads and writes on such files.
  181. .PP
  182. .I Srvfs
  183. invokes
  184. .I exportprog
  185. (default
  186. .BR /bin/exportfs )
  187. to create a mountable file system from a name space
  188. and posts it at
  189. .BI /srv/ name ,
  190. which is created with mode
  191. .I perm
  192. (default 0600).
  193. The name space is the directory tree rooted at
  194. .IR path .
  195. The
  196. .BR -d ,
  197. .BR -P ,
  198. and
  199. .B -R
  200. options, if present, are relayed to
  201. .IR exportprog .
  202. .SH EXAMPLES
  203. To export the archive of one user for one month, except for secrets,
  204. .IP
  205. .EX
  206. cd /n/dump
  207. echo '+ ^\e.(/2003(/10..(/usr(/glenda/?)?)?)?)?' > /tmp/pattern
  208. echo '- \e.(aes|pgp)$' >> /tmp/pattern
  209. exportfs -P /tmp/pattern
  210. .EE
  211. .LP
  212. Use
  213. .I srvfs
  214. to enable mounting of an FTP file system (see
  215. .IR ftpfs (4))
  216. in several windows,
  217. or to publish a
  218. .B /proc
  219. (see
  220. .IR proc (3))
  221. with a broken process so a remote person may debug the program:
  222. .IP
  223. .EX
  224. srvfs ftp /n/ftp
  225. srvfs broke /mnt/term/proc
  226. .EE
  227. .LP
  228. Use
  229. .I srvfs
  230. to obtain a copy of a service to be manipulated directly
  231. by a user program like
  232. .IR nfsserver (8):
  233. .IP
  234. .EX
  235. srvfs nfs.boot /srv/boot
  236. aux/nfsserver -f /srv/nfs.boot
  237. .EE
  238. .LP
  239. Use
  240. .I srvfs
  241. to spy on all accesses to a particular subtree:
  242. .IP
  243. .EX
  244. srvfs -d spy /
  245. tail -f /tmp/exportdb &
  246. mount /srv/spy /n/spy
  247. cd /n/spy; ls
  248. .EE
  249. .SH SOURCE
  250. .B /sys/src/cmd/exportfs
  251. .br
  252. .B /sys/src/cmd/srvfs.c
  253. .SH SEE ALSO
  254. .IR dial (2),
  255. .IR import (4),
  256. .IR aan (8),
  257. .IR listen (8)