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