nfs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. .TH NFS 4
  2. .SH NAME
  3. nfs \- Sun network file system client
  4. .SH SYNOPSIS
  5. .B nfs
  6. [
  7. .B -DRv
  8. ]
  9. [
  10. .B -p
  11. .I perm
  12. ]
  13. [
  14. .B -s
  15. .I srvname
  16. ]
  17. [
  18. .B -u
  19. .I passwd
  20. .I group
  21. ]
  22. .I addr1
  23. [
  24. .I addr2
  25. ]
  26. .PP
  27. .B aux/portmap
  28. [
  29. .B -R
  30. ]
  31. .I host
  32. .I cmd
  33. ...
  34. .PP
  35. .B aux/nfsmount
  36. [
  37. .B -R
  38. ]
  39. .I host
  40. .I cmd
  41. ...
  42. .SH DESCRIPTION
  43. .I Nfs
  44. translates between the Sun network file system protocol (NFS)
  45. and 9P, allowing 9P clients to mount file systems on NFS servers.
  46. NFS servers comprise two separate services: a mount service used to
  47. obtain the initial file handle, and a file service used to perform
  48. actual file system operations.
  49. The Sun port mapper service is typically used to find these two services.
  50. If one address is given, it is taken to be the address of a port mapper service;
  51. .I nfs
  52. queries the port mapper to find the addresses
  53. of the NFS mount service and file service.
  54. If two addresses are given, the port mapper is bypassed;
  55. .I addr1
  56. is used as the address of the NFS mount service,
  57. and
  58. .I addr2
  59. is used as the address of the file service.
  60. .PP
  61. The options are:
  62. .TP
  63. .B -D
  64. print all 9P messages.
  65. .TP
  66. .B -R
  67. print all NFS messages.
  68. .TP
  69. .B -v
  70. print verbose information about session startup.
  71. .TP
  72. .B -p \fIperm
  73. set the posted service file to have mode
  74. .IR perm ,
  75. which is assumed to be octal;
  76. the default is
  77. .BR 600 .
  78. .TP
  79. .B -s \fIsrvname
  80. post the service as
  81. .BI /srv/ srvname \fR;
  82. the default is
  83. .BI /srv/ addr1 \fR.
  84. .TP
  85. .B -u \fIpasswd\fR \fIgroup
  86. translate user and group names using the
  87. .I passwd
  88. and
  89. .I group
  90. files, which are in the traditional Unix format.
  91. The translation is used to present names for
  92. user and group in
  93. .IR stat (5)
  94. and
  95. .I wstat
  96. messages.
  97. The translation is also used to
  98. choose the user and group credentials
  99. to present for a user.
  100. Without this option, users and groups are presented
  101. as decimal numbers, and everyone attaches as uid \-1
  102. .RB ( nobody
  103. on most Unix systems).
  104. .PP
  105. .I Portmap
  106. and
  107. .I nfsmount
  108. are test programs to perform port mapper and NFS mount RPCs.
  109. They
  110. are useful mainly to help debug problems with
  111. starting
  112. .I nfs
  113. itself.
  114. The
  115. .B -R
  116. option causes them to print all RPC messages sent and received.
  117. .PP
  118. .I Portmap
  119. queries a Sun RPC portmap server, which maps integer
  120. (program, version, protocol) triples to port numbers.
  121. Program and version are Sun RPC defined, while protocol
  122. is typically TCP (6) or UDP (17).
  123. The commands are:
  124. .TP
  125. .B null
  126. a no-op
  127. .TP
  128. .B dump
  129. print the entire map
  130. .TP
  131. .B set \fIprog\fP \fIvers\fP \fIproto\fP \fIport\fP
  132. add an entry to (or replace an entry in) the map
  133. .TP
  134. .B unset \fIprog\fP \fIvers\fP \fIproto\fP \fIport\fP
  135. remove an entry from the map
  136. .TP
  137. .B getport \fIprog\fP \fIvers\fP \fIproto\fP
  138. look for an entry with \fIprog\fP, \fIvers\fP, \fIproto\fP
  139. in the map, and return the corresponding port
  140. .PD
  141. The default command is
  142. .BR dump .
  143. For running NFS over UDP, there must be an entry
  144. for the NFS v3 mount daemon (100005, 3, 17) and the
  145. NFS v3 server itself (100003, 3, 17).
  146. .PP
  147. .I Nfsmount
  148. queries a Sun NFS mount server, which authenticates (ha!)
  149. connections and hands out file handles naming the root of
  150. an exported file system. This handle is used as the basis
  151. for a conversation with the NFS service daemon itself.
  152. The commands are:
  153. .TP
  154. .B null
  155. a no-op
  156. .TP
  157. .B export
  158. dump the export table;
  159. each line is a path followed by a list of machines or groups
  160. allowed to mount that path
  161. .TP
  162. .B mnt \fIpath\fR
  163. attempt to acquire a file handle for \fIpath\fR.
  164. the request has user and group id 1001 and
  165. .L gnot
  166. as the system name.
  167. .TP
  168. .B umnt \fIpath\fR
  169. notify the mount daemon that a particular path is being
  170. unmounted by the requesting system
  171. .TP
  172. .B umntall
  173. notify the mount daemon that all paths mounted by the
  174. requesting system are being unmounted
  175. .TP
  176. .B dump
  177. should also dump an export table, but typically
  178. does nothing
  179. .PD
  180. .SH EXAMPLE
  181. We use this in our
  182. .B /rc/bin/9fs
  183. script to mount all the home directories served by
  184. .IR bopp :
  185. .IP
  186. .EX
  187. case bopp
  188. if(! test -f /srv/bopp)
  189. nfs -p 666 -u /lib/ndb/1127.passwd /lib/ndb/1127.group bopp
  190. unmount /n/bopp >[2]/dev/null
  191. for(i in u0 u1 u2 u3 u4 u5 u6 u7 u8 u9)
  192. mount -a /srv/bopp /n/bopp /$i
  193. .EE
  194. .SH SOURCE
  195. .B /sys/src/cmd/nfs.c
  196. .br
  197. .B /sys/src/libsunrpc
  198. .SH "SEE ALSO
  199. .IR nfsserver (8),
  200. .IR srv (4)
  201. .SH BUGS
  202. The authentication employed by NFS is laughable.
  203. The server simply trusts the uid, gid, and group list
  204. presented by the client.
  205. .PP
  206. .I Nfs
  207. speaks only NFS version 3.
  208. Older operating systems typically
  209. have reasonable NFS version 2 servers
  210. but crash when serving version 3.