exportfs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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. A corresponding
  143. .IR import (4)
  144. must use the
  145. .B -m
  146. option.
  147. .TP
  148. .B -S \fIservice
  149. Bypass the initial protocol, serving the result of mounting
  150. .IR service .
  151. A separate mount is used for each
  152. .IR attach (5)
  153. message,
  154. to correctly handle servers in which each mount
  155. corresponds to a different client
  156. (e.g.,
  157. .IR rio (4)).
  158. A corresponding
  159. .IR import (4)
  160. must use the
  161. .B -m
  162. option.
  163. .TP
  164. .B -s
  165. equivalent to
  166. .B -r
  167. .BR / ;
  168. kept for compatibility.
  169. .PD
  170. .PP
  171. The
  172. .B cpu
  173. command uses
  174. .I exportfs
  175. to serve device files in the terminal. The
  176. .IR import (4)
  177. command calls
  178. .I exportfs
  179. on a remote machine, permitting users to access arbitrary pieces of
  180. name space on other systems.
  181. .PP
  182. Because the kernel disallows reads and writes on mounted pipes
  183. (as might be found in
  184. .BR /srv ),
  185. .I exportfs
  186. calls itself (with appropriate
  187. .B -m
  188. and
  189. .B -S
  190. options) to simulate reads and writes on such files.
  191. .PP
  192. .I Srvfs
  193. invokes
  194. .I exportprog
  195. (default
  196. .BR /bin/exportfs )
  197. to create a mountable file system from a name space
  198. and posts it at
  199. .BI /srv/ name ,
  200. which is created with mode
  201. .I perm
  202. (default 0600).
  203. The name space is the directory tree rooted at
  204. .IR path .
  205. The
  206. .BR -d ,
  207. .BR -P ,
  208. and
  209. .B -R
  210. options, if present, are relayed to
  211. .IR exportprog .
  212. .SH EXAMPLES
  213. To export the archive of one user for one month, except for secrets,
  214. .IP
  215. .EX
  216. cd /n/dump
  217. echo '+ ^\e.(/2003(/10..(/usr(/glenda/?)?)?)?)?' > /tmp/pattern
  218. echo '- \e.(aes|pgp)$' >> /tmp/pattern
  219. exportfs -P /tmp/pattern
  220. .EE
  221. .LP
  222. Use
  223. .I srvfs
  224. to enable mounting of an FTP file system (see
  225. .IR ftpfs (4))
  226. in several windows,
  227. or to publish a
  228. .B /proc
  229. (see
  230. .IR proc (3))
  231. with a broken process so a remote person may debug the program:
  232. .IP
  233. .EX
  234. srvfs ftp /n/ftp
  235. srvfs broke /mnt/term/proc
  236. .EE
  237. .LP
  238. Use
  239. .I srvfs
  240. to obtain a copy of a service to be manipulated directly
  241. by a user program like
  242. .IR nfsserver (8):
  243. .IP
  244. .EX
  245. srvfs nfs.boot /srv/boot
  246. aux/nfsserver -f /srv/nfs.boot
  247. .EE
  248. .LP
  249. Use
  250. .I srvfs
  251. to spy on all accesses to a particular subtree:
  252. .IP
  253. .EX
  254. srvfs -d spy /
  255. tail -f /tmp/exportdb &
  256. mount /srv/spy /n/spy
  257. cd /n/spy; ls
  258. .EE
  259. .SH SOURCE
  260. .B /sys/src/cmd/exportfs
  261. .br
  262. .B /sys/src/cmd/srvfs.c
  263. .SH SEE ALSO
  264. .IR dial (2),
  265. .IR import (4),
  266. .IR aan (8),
  267. .IR listen (8)