import 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. .TH IMPORT 4
  2. .SH NAME
  3. import \- import a name space from a remote system
  4. .SH SYNOPSIS
  5. .B import
  6. [
  7. .I options
  8. ]
  9. .I system
  10. .I file
  11. [
  12. .I mountpoint
  13. ]
  14. .PP
  15. .B import
  16. .B -m
  17. [
  18. .I options
  19. ]
  20. .I system
  21. .I mountpoint
  22. .PP
  23. .B import
  24. .B -B
  25. [
  26. .I options
  27. ]
  28. .I mountpoint
  29. [
  30. .I cmd
  31. [
  32. .I args ...
  33. ]
  34. ]
  35. .SH DESCRIPTION
  36. .I Import
  37. allows an arbitrary
  38. .I file
  39. on a remote
  40. .I system
  41. to be imported into the local name space.
  42. Usually
  43. .I file
  44. is a directory, so the complete
  45. file tree under the directory is made available.
  46. .PP
  47. A process is started on the
  48. remote machine, with authority of the user of
  49. .IR import ,
  50. to perform work for the local machine using the
  51. .IR exportfs (4)
  52. service.
  53. The default port used is TCP 17007.
  54. If
  55. .I mountpoint
  56. is omitted
  57. .I import
  58. uses the name of the remote
  59. .I file
  60. as the local mount point.
  61. .PP
  62. The options are:
  63. .TF "-s namexxx"
  64. .PD
  65. .TP
  66. .B -a -b -c -C
  67. Control the construction of union directories, as in
  68. .I mount
  69. and
  70. .IR bind (1).
  71. Only valid when
  72. .I file
  73. is a directory.
  74. .TP
  75. .B -A
  76. Skip the authentication protocol.
  77. This is useful for connecting to foreign systems like Inferno.
  78. .TP
  79. .B -B
  80. Run in ``backwards'' mode, described below.
  81. .TP
  82. .B -E \fIenc
  83. Push an authentication protocol on its network connection.
  84. The supported protocols are
  85. .B clear
  86. (the default, no protocol)
  87. and
  88. .BR ssl .
  89. There are plans to make
  90. .B tls
  91. available.
  92. .TP
  93. .B -e '\fIenc auth\fR'
  94. Specify the encryption and authentication algorithms to use for
  95. encrypting the wire traffic
  96. (see
  97. .IR ssl (3)).
  98. The defaults are
  99. .B rc4_256
  100. and
  101. .BR sha1 .
  102. .TP
  103. .B -k \fIkeypattern
  104. Use
  105. .I keypattern
  106. to select a key to authenticate to the remote side
  107. (see
  108. .IR auth (2)).
  109. .TP
  110. .B -o -O
  111. These equivalent flags run
  112. .I import
  113. in a pre-9P2000 compatibility mode to import from ancient servers.
  114. .TP
  115. .B -p
  116. Push the
  117. .IR aan (8)
  118. filter onto the connection to protect against
  119. temporary network outages.
  120. .TP
  121. .B -s \fIname
  122. Post the connection's mountable file descriptor as
  123. .BI /srv/ name\fR.
  124. .PD
  125. .PP
  126. The
  127. .B -m
  128. option mounts a file exported by
  129. .IR exportfs (4)
  130. with its
  131. .B -r
  132. or
  133. .B -S
  134. options, which skip the part of its protocol that allows the importer to specify
  135. the
  136. .I file
  137. to export.
  138. Instead, the file or name space is selected by
  139. .IR exportfs ,
  140. and
  141. .I import
  142. mounts it on
  143. .I mountpoint
  144. as guided by the other
  145. .IR options .
  146. .PP
  147. The
  148. .B -B
  149. option runs
  150. .I import
  151. in ``backwards'' mode.
  152. In this mode,
  153. .I import
  154. runs a
  155. .I p9any
  156. authentication (as server) over its file descriptor 0
  157. (expected to be an incoming network connection from
  158. .B exportfs
  159. .BR -B ),
  160. mounts the connection onto
  161. .IR mntpt ,
  162. and optionally runs
  163. .I cmd
  164. .IR args .
  165. .SH EXAMPLES
  166. Assume a machine
  167. .B kremvax
  168. that has IP interfaces for the company intranet and the global
  169. internet mounted on
  170. .I /net
  171. and
  172. .I /net.alt
  173. respectively.
  174. Any machine inside the company can get telnet out to the global
  175. internet using:
  176. .IP
  177. .EX
  178. import -a kremvax /net.alt
  179. telnet /net.alt/tcp!ucbvax
  180. .EE
  181. .PP
  182. Suppose that the machine
  183. .B moscvax
  184. has access to a private file server containing public web pages
  185. that need to be served by the less-trusted server
  186. .BR webvax .
  187. .B Webvax
  188. runs the following listener
  189. (see
  190. .IR listen (8))
  191. on TCP port 999:
  192. .IP
  193. .EX
  194. #!/bin/rc
  195. import -B -s rowebfs /usr/web /bin/restarthttpd
  196. .EE
  197. .PP
  198. When
  199. .B moscvax
  200. boots, it runs
  201. .IP
  202. .EX
  203. exportfs -R -r /usr/web -B tcp!webvax!999
  204. .EE
  205. .PP
  206. to serve a read-only copy of
  207. .B /usr/web
  208. to
  209. .BR webvax .
  210. When
  211. .B webvax
  212. gets the call,
  213. .B import
  214. mounts the served tree onto its own
  215. .B /usr/web
  216. and then runs
  217. .B /bin/restarthttpd
  218. to restart
  219. .IR httpd (8).
  220. .SH SOURCE
  221. .B /sys/src/cmd/import.c
  222. .SH SEE ALSO
  223. .IR bind (1),
  224. .IR ssl (3),
  225. .IR exportfs (4),
  226. .IR srv (4),
  227. .IR aan (8),
  228. .IR listen (8),
  229. .B cs
  230. in
  231. .IR ndb (8)