u9fs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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 9p1 .
  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).
  102. Specifying
  103. .B 9p1
  104. uses the second and third edition Plan 9 authentication mechanisms.
  105. The file
  106. .BR /etc/u9fs.key ,
  107. or
  108. .I autharg
  109. if specified
  110. (see the
  111. .B -A
  112. option),
  113. is consulted for the authentication data.
  114. The file must contain exactly three lines:
  115. the plaintext password, the user id, and
  116. the authentication domain.
  117. .TP
  118. .BI -A " autharg
  119. Used to specify an argument to the authentication method.
  120. See the authentication descriptions above.
  121. .TP
  122. .BI -l " logfile
  123. Specifies the file which should contain debugging output
  124. and other messages.
  125. The out-of-the-box compile-time default is
  126. .BR /tmp/u9fs.log .
  127. .TP
  128. .BI -m " msize
  129. Set
  130. .I msize
  131. for 9P2000
  132. (see
  133. .IR open (5)).
  134. .TP
  135. .BI -u " user
  136. Treat all attaches as coming from
  137. .IR user .
  138. This is useful in some cases when running without
  139. .IR inetd ;
  140. see the examples.
  141. .SH
  142. EXAMPLES
  143. .PP
  144. Plan 9 calls 9P file service
  145. .B 9fs
  146. with TCP port number 564.
  147. Set up this way on a machine called, say,
  148. .BR kremvax ,
  149. .I u9fs
  150. may be connected to the name space of a Plan 9 process by
  151. .IP
  152. .EX
  153. 9fs kremvax
  154. .EE
  155. .PP
  156. For more information on this procedure, see
  157. .IR srv (4)
  158. and
  159. .IR bind (1).
  160. .PP
  161. .I U9fs
  162. serves the entire file system of the Unix machine.
  163. It forbids access to devices
  164. because the program is single-threaded and may block unpredictably.
  165. Using the
  166. .B attach
  167. specifier
  168. .B device
  169. connects to a file system identical to the usual system except
  170. it only permits device access (and may block unpredictably):
  171. .IP
  172. .EX
  173. srv tcp!kremvax!9fs
  174. mount -c /srv/tcp!kremvax!9fs /n/kremvax device
  175. .EE
  176. .PP
  177. (The
  178. .B 9fs
  179. command
  180. does not accept an attach specifier.)
  181. Even so,
  182. device access may produce unpredictable
  183. results if the block size of the device is greater than 8192,
  184. the maximum data size of a 9P message.
  185. .PP
  186. The source to
  187. .I u9fs
  188. is in the Plan 9 directory
  189. .BR /sys/src/cmd/unix/u9fs .
  190. To install
  191. .I u9fs
  192. on a Unix system with an ANSI C compiler, copy the source to a directory on that system
  193. and run
  194. .BR make .
  195. Then install the binary in
  196. .BR /usr/etc/u9fs .
  197. Add this line to
  198. .BR inetd.conf :
  199. .IP
  200. .EX
  201. 9fs stream tcp nowait root /usr/etc/u9fs u9fs
  202. .EE
  203. .PP
  204. and this to
  205. .BR services :
  206. .IP
  207. .EX
  208. 9fs 564/tcp 9fs # Plan 9 fs
  209. .EE
  210. .LP
  211. Due to a bug in their
  212. IP software, some systems will not accept the service name
  213. .BR 9fs ,
  214. thinking it
  215. a service number because of the initial digit.
  216. If so, run the service as
  217. .B u9fs
  218. or
  219. .BR 564 .
  220. .PP
  221. On systems where listeners cannot be started,
  222. .IR execnet (4)
  223. is useful for running
  224. .I u9fs
  225. via mechanisms like
  226. .IR ssh .
  227. .SH SOURCE
  228. .B /sys/src/cmd/unix/u9fs
  229. .SH DIAGNOSTICS
  230. Problems are reported to the
  231. log file specified with the
  232. .B -l
  233. option (default
  234. .BR /tmp/u9fs.log ).
  235. The
  236. .B -D
  237. flag enables chatty debugging.
  238. .SH SEE ALSO
  239. .IR bind (1),
  240. .IR execnet (4),
  241. .IR srv (4),
  242. .IR ip (3),
  243. .IR nfsserver (8)
  244. .SH BUGS
  245. The implementation of devices is unsatisfactory.
  246. .LP
  247. Semantics like remove-on-close or the
  248. atomicity of
  249. .B wstat
  250. are hard to provide exactly.