u9fs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. .TH U9FS 4
  2. .SH NAME
  3. u9fs \- serve 9P from Unix
  4. .SH SYNOPSIS
  5. .B u9fs
  6. [
  7. .B -Dnz
  8. ]
  9. [
  10. .B -a
  11. .I authtype
  12. ]
  13. [
  14. .B -A
  15. .I autharg
  16. ]
  17. [
  18. .B -l
  19. .I logfile
  20. ]
  21. [
  22. .B -m
  23. .I msize
  24. ]
  25. [
  26. .B -u
  27. .I onlyuser
  28. ]
  29. .SH DESCRIPTION
  30. .I U9fs
  31. is
  32. .I not
  33. a Plan 9 program. Instead it is a program that
  34. serves Unix files to Plan 9 machines using the 9P protocol
  35. (see
  36. .IR intro (5)).
  37. It is typically invoked on a
  38. Unix machine by
  39. .B inetd
  40. with its standard input and output connected to a
  41. network connection, typically TCP on an Ethernet.
  42. It typically runs as user
  43. .B root
  44. and multiplexes access to multiple Plan 9 clients over the single wire.
  45. It assumes Plan 9 uids match Unix login names,
  46. and changes to the corresponding Unix effective uid when processing requests.
  47. .I U9fs
  48. serves both 9P1 (the 9P protocol as used by
  49. the second and third editions of Plan 9) and 9P2000.
  50. .PP
  51. The options are:
  52. .TP
  53. .B -D
  54. Write very chatty debugging output to the log file (see
  55. .B -l
  56. option below).
  57. .TP
  58. .B -n
  59. Signals that
  60. .I u9fs
  61. is
  62. .I not
  63. being invoked with a network connection
  64. on standard input and output, and thus should
  65. not try to determine the remote address of the connection.
  66. This is useful when
  67. .I u9fs
  68. is not invoked from
  69. .I inetd
  70. (see examples below).
  71. .TP
  72. .B -z
  73. Truncate the log file on startup. This is useful mainly when debugging
  74. with
  75. .BR -D .
  76. .TP
  77. .BI -a " authtype
  78. Sets the authentication method to be used.
  79. .I Authtype
  80. should be
  81. .BR rhosts ,
  82. .BR none ,
  83. or
  84. .BR p9any .
  85. The default is
  86. .BR rhosts ,
  87. which uses the
  88. .I ruserok
  89. library call to authenticate users by entries in
  90. .B /etc/hosts.equiv
  91. or
  92. .BR $HOME/.rhosts .
  93. This default is discouraged for all but the most controlled networks.
  94. Specifying
  95. .B none
  96. turns off authentication altogether.
  97. This is useful when
  98. .I u9fs
  99. is not invoked from
  100. .I inetd
  101. (see examples below, or
  102. .I srvssh
  103. in .IR srv (4)).
  104. Specifying
  105. .B p9any
  106. uses the fourth edition Plan 9 authentication mechanisms.
  107. The file
  108. .BR /etc/u9fs.key ,
  109. or
  110. .I autharg
  111. if specified
  112. (see the
  113. .B -A
  114. option),
  115. is consulted for the authentication data.
  116. The file must contain exactly three lines:
  117. the plaintext password, the user id, and
  118. the authentication domain.
  119. .TP
  120. .BI -A " autharg
  121. Used to specify an argument to the authentication method.
  122. See the authentication descriptions above.
  123. .TP
  124. .BI -l " logfile
  125. Specifies the file which should contain debugging output
  126. and other messages.
  127. The out-of-the-box compile-time default is
  128. .BR /tmp/u9fs.log .
  129. .TP
  130. .BI -m " msize
  131. Set
  132. .I msize
  133. for 9P2000
  134. (see
  135. .IR open (5)).
  136. .TP
  137. .BI -u " user
  138. Treat all attaches as coming from
  139. .IR user .
  140. This is useful in some cases when running without
  141. .IR inetd ;
  142. see the examples.
  143. .SH
  144. EXAMPLES
  145. .PP
  146. Plan 9 calls 9P file service
  147. .B 9fs
  148. with TCP port number 564.
  149. Set up this way on a machine called, say,
  150. .BR kremvax ,
  151. .I u9fs
  152. may be connected to the name space of a Plan 9 process by
  153. .IP
  154. .EX
  155. 9fs kremvax
  156. .EE
  157. .PP
  158. For more information on this procedure, see
  159. .IR srv (4)
  160. and
  161. .IR bind (1).
  162. .PP
  163. .I U9fs
  164. serves the entire file system of the Unix machine.
  165. It forbids access to devices
  166. because the program is single-threaded and may block unpredictably.
  167. Using the
  168. .B attach
  169. specifier
  170. .B device
  171. connects to a file system identical to the usual system except
  172. it only permits device access (and may block unpredictably):
  173. .IP
  174. .EX
  175. srv tcp!kremvax!9fs
  176. mount -c /srv/tcp!kremvax!9fs /n/kremvax device
  177. .EE
  178. .PP
  179. (The
  180. .B 9fs
  181. command
  182. does not accept an attach specifier.)
  183. Even so,
  184. device access may produce unpredictable
  185. results if the block size of the device is greater than 8192,
  186. the maximum data size of a 9P message.
  187. .PP
  188. The source to
  189. .I u9fs
  190. is in the Plan 9 directory
  191. .BR /sys/src/cmd/unix/u9fs .
  192. To install
  193. .I u9fs
  194. on a Unix system with an ANSI C compiler, copy the source to a directory on that system
  195. and run
  196. .BR make .
  197. Then install the binary in
  198. .BR /usr/etc/u9fs .
  199. Add this line to
  200. .BR inetd.conf :
  201. .IP
  202. .EX
  203. 9fs stream tcp nowait root /usr/etc/u9fs u9fs
  204. .EE
  205. .PP
  206. and this to
  207. .BR services :
  208. .IP
  209. .EX
  210. 9fs 564/tcp 9fs # Plan 9 fs
  211. .EE
  212. .LP
  213. Due to a bug in their
  214. IP software, some systems will not accept the service name
  215. .BR 9fs ,
  216. thinking it
  217. a service number because of the initial digit.
  218. If so, run the service as
  219. .B u9fs
  220. or
  221. .BR 564 .
  222. .PP
  223. On systems where listeners cannot be started,
  224. .IR execnet (4)
  225. is useful for running
  226. .I u9fs
  227. via mechanisms like
  228. .IR ssh .
  229. .SH SOURCE
  230. .B /sys/src/cmd/unix/u9fs
  231. .SH DIAGNOSTICS
  232. Problems are reported to the
  233. log file specified with the
  234. .B -l
  235. option (default
  236. .BR /tmp/u9fs.log ).
  237. The
  238. .B -D
  239. flag enables chatty debugging.
  240. .SH SEE ALSO
  241. .IR bind (1),
  242. .IR execnet (4),
  243. .IR srv (4),
  244. .IR ip (3),
  245. .IR nfsserver (8)
  246. .SH BUGS
  247. The implementation of devices is unsatisfactory.
  248. .LP
  249. Semantics like remove-on-close or the
  250. atomicity of
  251. .B wstat
  252. are hard to provide exactly.