exportfs 4.5 KB

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