-
Notifications
You must be signed in to change notification settings - Fork 1
/
u9fs.man
289 lines (289 loc) · 5.24 KB
/
u9fs.man
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
.TH U9FS 4
.SH NAME
u9fs \- serve 9P from Unix
.SH SYNOPSIS
.B u9fs
[
.B -Dnz
]
[
.B -a
.I authtype
]
[
.B -A
.I autharg
]
[
.B -l
.I logfile
]
[
.B -m
.I msize
]
[
.B -u
.I onlyuser
]
.I fsroot
.SH DESCRIPTION
.I U9fs
is
.I not
a Plan 9 program. Instead it is a program that
serves Unix files to Plan 9 machines using the 9P protocol
(see
.IR intro (5)).
It is typically invoked on a
Unix machine by
.B inetd
with its standard input and output connected to a
network connection, typically TCP on an Ethernet.
It typically runs as user
.B root
and multiplexes access to multiple Plan 9 clients over the single wire.
It assumes Plan 9 uids match Unix login names,
and changes to the corresponding Unix effective uid when processing requests.
Characters in file and directory names unacceptable to Plan 9 are translated
into a three-character sequence:
.L \e
followed by two hexadecimal digits.
.I U9fs
serves both 9P1 (the 9P protocol as used by
the second and third editions of Plan 9) and 9P2000.
.PP
The options are:
.TF "\fL-A \fIautharg"
.PD
.TP
.B -D
Write very chatty debugging output to the log file (see
.B -l
option below).
.TP
.B -n
Signals that
.I u9fs
is
.I not
being invoked with a network connection
on standard input and output, and thus should
not try to determine the remote address of the connection.
This is useful when
.I u9fs
is not invoked from
.I inetd
(see examples below).
.TP
.B -z
Truncate the log file on startup. This is useful mainly when debugging
with
.BR -D .
.TP
.BI -a " authtype
Sets the authentication method to be used.
.I Authtype
should be
.BR rhosts ,
.BR none ,
or
.BR p9any .
The default is
.BR rhosts ,
which uses the
.I ruserok
library call to authenticate users by entries in
.B /etc/hosts.equiv
or
.BR $HOME/.rhosts .
This default is discouraged for all but the most controlled networks.
Specifying
.B none
turns off authentication altogether.
This is useful when
.I u9fs
is not invoked from
.I inetd
(see examples below, or
.I srvssh
in
.IR srv (4)).
Specifying
.B p9any
uses the fourth edition Plan 9 authentication mechanisms.
The file
.BR /etc/u9fs.key ,
or
.I autharg
if specified
(see the
.B -A
option),
is consulted for the authentication data
and should be suitably protected.
This file must contain exactly three lines:
.I secret
(plaintext password),
.I u9fs-user
(user id),
and
.I plan9-auth.dom
(authentication domain).
.RS
.LP
Finally,
.I factotum
must be taught a key of the form:
.LP
.EX
.B
key proto=p9sk1 dom=\fIplan9-auth.dom\fP user=\fIu9fs-user\fP !password=\fIsecret\fP
.EE
.RE
.TP
.BI -A " autharg
Used to specify an argument to the authentication method.
See the authentication descriptions above.
.TP
.BI -l " logfile
Specifies the file which should contain debugging output
and other messages.
The out-of-the-box compile-time default is
.BR /tmp/u9fs.log .
.TP
.BI -m " msize
Set
.I msize
for 9P2000
(see
.IR open (5)).
.TP
.BI -u " user
Treat all attaches as coming from
.IR user .
This is useful in some cases when running without
.IR inetd ;
see the examples.
.PP
If
.I fsroot
is specified,
.I u9fs
will serve only that tree; othwise, it will serve the entire Unix
file system.
.SH EXAMPLES
.PP
Plan 9 calls 9P file service
.B 9fs
with TCP port number 564.
Set up this way on a machine called, say,
.BR kremvax ,
.I u9fs
may be connected to the name space of a Plan 9 process by
.IP
.EX
9fs kremvax
.EE
.PP
For more information on this procedure, see
.IR srv (4)
and
.IR bind (1).
.PP
By default,
.I u9fs
serves the entire file system of the Unix machine.
It forbids access to devices
because the program is single-threaded and may block unpredictably.
Using the
.B attach
specifier
.B device
connects to a file system identical to the usual system except
it only permits device access (and may block unpredictably):
.IP
.EX
srv tcp!kremvax!9fs
mount -c /srv/tcp!kremvax!9fs /n/kremvax device
.EE
.PP
(The
.B 9fs
command
does not accept an attach specifier.)
Even so,
device access may produce unpredictable
results if the block size of the device is greater than 8192,
the maximum data size of a 9P message.
.PP
The source to
.I u9fs
is in the Plan 9 directory
.BR /sys/src/cmd/unix/u9fs .
To install
.I u9fs
on a Unix system with an ANSI C compiler, copy the source to a directory on that system
and run
.BR make .
Then install the binary in
.BR /usr/etc/u9fs .
Add this line to
.BR inetd.conf :
.IP
.EX
9fs stream tcp nowait root /usr/etc/u9fs u9fs
.EE
.PP
and this to
.BR services :
.IP
.EX
9fs 564/tcp 9fs # Plan 9 fs
.EE
.LP
Due to a bug in their
IP software, some systems will not accept the service name
.BR 9fs ,
thinking it
a service number because of the initial digit.
If so, run the service as
.B u9fs
or
.BR 564 .
.PP
On systems where listeners cannot be started,
.IR execnet (4)
is useful for running
.I u9fs
via other network mechanisms; the script
.I srvssh
in
.IR srv (4)
provides this for the
.I ssh
protocol.
.SH SOURCE
.B /sys/src/cmd/unix/u9fs
.SH DIAGNOSTICS
Problems are reported to the
log file specified with the
.B -l
option (default
.BR /tmp/u9fs.log ).
The
.B -D
flag enables chatty debugging.
.SH SEE ALSO
.IR bind (1),
.IR execnet (4),
.IR srv (4),
.IR ip (3),
.IR nfsserver (8)
.SH BUGS
The implementation of devices is unsatisfactory.
.LP
Semantics like remove-on-close or the
atomicity of
.B wstat
are hard to provide exactly.