added notes on the new FAST_SHARE_MODES code
[ira/wip.git] / docs / INSTALL.txt
1 HOW TO INSTALL AND TEST SAMBA
2 =============================
3
4
5 STEP 0. Read the man pages. They contain lots of useful info that will
6 help to get you started. If you don't know how to read man pages then
7 try something like:
8
9         nroff -man smbd.8 | more
10
11 STEP 1. Building the binaries
12
13 To do this, first edit the file source/Makefile. You will find that
14 the Makefile has an entry for most unixes and you need to uncomment
15 the one that matches your operating system.
16
17 You should also edit the section at the top of the Makefile which
18 determines where things will be installed. You need to get this right
19 before compilation as Samba needs to find some things at runtime
20 (smbrun in particular). There are also settings for where you want
21 your log files etc. Make sure you get these right, and that the
22 directories exist.
23
24 Then type "make". This will create the binaries.
25
26 Once it's successfully compiled you can use "make install" to install
27 the binaries and manual pages. You can separately install the binaries
28 and/or man pages using "make installbin" and "make installman".
29
30 Note that if you are upgrading for a previous version of Samba you
31 might like to know that the old versions of the binaries will be
32 renamed with a ".old" extension. You can go back to the previous
33 version with "make revert" if you find this version a disaster!
34
35 STEP 2. The all important step
36
37 At this stage you must fetch yourself a coffee or other drink you find
38 stimulating. Getting the rest of the install right can sometimes be
39 tricky, so you will probably need it.
40
41 If you have installed samba before then you can skip this step.
42
43 STEP 3. Create the smb configuration file. 
44
45 There are sample configuration files in the examples subdirectory in
46 the distribution. I suggest you read them carefully so you can see how
47 the options go together in practice. See the man page for all the
48 options.
49
50 The simplest useful configuration file would be something like this:
51
52 [homes]
53         workgroup = MYGROUP
54         guest ok = no
55         read only = no
56
57 which would allow connections by anyone with an account on the server,
58 using either their login name or "homes" as the service name. (Note
59 that I also set the workgroup that Samba is part of. See BROWSING.txt
60 for defails)
61
62 Note that "make install" will not install a smb.conf file. You need to
63 create it yourself. You will also need to create the path you specify
64 in the Makefile for the logs etc, such as /usr/local/samba.
65
66 Make sure you put the smb.conf file in the same place you specified in
67 the Makefile.
68
69 STEP 4. Test your config file with testparm
70
71 It's important that you test the validity of your smb.conf file using
72 the testparm program. If testparm runs OK then it will list the loaded
73 services. If not it will give an error message.
74
75 Make sure it runs OK and that the services look resonable before
76 proceeding. 
77
78 STEP 5. Starting the smbd and nmbd. 
79
80 You must choose to start smbd and nmbd either as daemons or from
81 inetd. Don't try to do both!  Either you can put them in inetd.conf
82 and have them started on demand by inetd, or you can start them as
83 daemons either from the command line or in /etc/rc.local. See the man
84 pages for details on the command line options.
85
86 The main advantage of starting smbd and nmbd as a daemon is that they
87 will respond slightly more quickly to an initial connection
88 request. This is, however, unlilkely to be a problem.
89
90 Step 5a. Starting from inetd.conf
91
92 NOTE; The following will be different if you use NIS or NIS+ to
93 distributed services maps.
94
95 Look at your /etc/services. What is defined at port 139/tcp. If
96 nothing is defined then add a line like this:
97
98 netbios-ssn     139/tcp
99
100 similarly for 137/udp you should have an entry like:
101
102 netbios-ns      137/udp
103
104 Next edit your /etc/inetd.conf and add two lines something like this:
105
106 netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd 
107 netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd 
108
109 The exact syntax of /etc/inetd.conf varies between unixes. Look at the
110 other entries in inetd.conf for a guide.
111
112 NOTE: Some unixes already have entries like netbios_ns (note the
113 underscore) in /etc/services. You must either edit /etc/services or
114 /etc/inetd.conf to make them consistant.
115
116 NOTE: On many systems you may need to use the "interfaces" option in
117 smb.conf to specify the IP address and netmask of your interfaces. Run
118 ifconfig as root if you don't know what the broadcast is for your
119 net. nmbd tries to determine it at run time, but fails on some
120 unixes. See the section on "testing nmbd" for a method of finding if
121 you need to do this.
122
123 !!!WARNING!!! Many unixes only accept around 5 parameters on the
124 command line in inetd. This means you shouldn't use spaces between the
125 options and arguments, or you should use a script, and start the
126 script from inetd.
127
128 Restart inetd, perhaps just send it a HUP. If you have installed an
129 earlier version of nmbd then you may need to kill nmbd as well.
130
131 Step 5b. Alternative: starting it as a daemon
132
133 To start the server as a daemon you should create a script something
134 like this one, perhaps calling it "startsmb"
135
136 #!/bin/sh
137 /usr/local/samba/bin/smbd -D 
138 /usr/local/samba/bin/nmbd -D 
139
140 then make it executable with "chmod +x startsmb"
141
142 You can then run startsmb by hand or execute it from /etc/rc.local
143
144 To kill it send a kill signal to the processes nmbd and smbd.
145
146 NOTE: If you use the SVR4 style init system then you may like to look
147 at the examples/svr4-startup script to make Samba fit into that system.
148
149
150 STEP 7. Try listing the shares available on your server
151
152 smbclient -L yourhostname 
153
154 Your should get back a list of shares available on your server. If you
155 don't then something is incorrectly setup. Note that this method can
156 also be used to see what shares are available on other LanManager
157 clients (such as WfWg).
158
159 If you choose user level security then you may find that Samba requests
160 a password before it will list the shares. See the smbclient docs for
161 details. (you can force it to list the shares without a password by
162 adding the option -U% to the command line. This will not work with
163 non-Samba servers)
164
165 STEP 8. try connecting with the unix client. eg:
166
167 smbclient '\\yourhostname\aservice'
168
169 Typically the "yourhostname" would be the name of the host where you
170 installed smbd. The "aservice" is any service you have defined in the
171 smb.conf file. Try your user name if you just have a [homes] section
172 in smb.conf.
173
174 For example if your unix host is bambi and your login name is fred you
175 would type:
176
177 smbclient '\\bambi\fred'
178
179 NOTE: The number of slashes to use depends on the type of shell you
180 use. You may need '\\\\bambi\\fred' with some shells.
181
182 STEP 9. Try connecting from a dos/WfWg/Win95/NT/os-2 client. Try
183 mounting disks. eg:
184
185 net use d: \\servername\service
186
187 Try printing. eg:
188
189 net use lpt1: \\servername\spoolservice
190 print filename
191
192 Celebrate, or send me a bug report!
193
194 WHAT IF IT DOESN'T WORK?
195 ========================
196
197 If nothing works and you start to think "who wrote this pile of trash"
198 then I suggest you do step 2 again (and again) till you calm down.
199
200 Then you might read the file DIAGNOSIS.txt and the FAQ. If you are
201 still stuck then try the mailing list or newsgroup (look in the README
202 for details). Samba has been successfully installed at thousands of
203 sites worldwide, so maybe someone else has hit your problem and has
204 overcome it. You could also use the WWW site to scan back issues of
205 the samba-digest.
206
207 When you fix the problem PLEASE send me some updates to the
208 documentation (or source code) so that the next person will find it
209 easier. 
210
211 DIAGNOSING PROBLEMS
212 ===================
213
214 If you have instalation problems then go to DIAGNOSIS.txt to try to
215 find the problem.
216
217 SCOPE IDs
218 =========
219
220 By default Samba uses a blank scope ID. This means all your windows
221 boxes must also have a blank scope ID. If you really want to use a
222 non-blank scope ID then you will need to use the -i <scope> option to
223 nmbd, smbd, and smbclient. All your PCs will need to have the same
224 setting for this to work. I do not recommend scope IDs.
225
226
227 CHOOSING THE PROTOCOL LEVEL
228 ===========================
229
230 The SMB protocol has many dialects. Currently Samba supports 5, called
231 CORE, COREPLUS, LANMAN1, LANMAN2 and NT1.
232
233 You can choose what protocols to support in the smb.conf file. The
234 default is NT1 and that is the best for the vast majority of sites.
235
236 In older versions of Samba you may have found it necessary to use
237 COREPLUS. The limitations that led to this have mostly been fixed. It
238 is now less likely that you will want to use less than LANMAN1. The
239 only remaining advantage of COREPLUS is that for some obscure reason
240 WfWg preserves the case of passwords in this protocol, whereas under
241 LANMAN1, LANMAN2 or NT1 it uppercases all passwords before sending them,
242 forcing you to use the "password level=" option in some cases.
243
244 The main advantage of LANMAN2 and NT1 is support for long filenames with some
245 clients (eg: smbclient, Windows NT or Win95). 
246
247 See the smb.conf manual page for more details.
248
249 Note: To support print queue reporting you may find that you have to
250 use TCP/IP as the default protocol under WfWg. For some reason if you
251 leave Netbeui as the default it may break the print queue reporting on
252 some systems. It is presumably a WfWg bug.
253
254
255 PRINTING FROM UNIX TO A CLIENT PC
256 =================================
257
258 To use a printer that is available via a smb-based server from a unix
259 host you will need to compile the smbclient program. You then need to
260 install the script "smbprint". Read the instruction in smbprint for
261 more details.
262
263 There is also a SYSV style script that does much the same thing called
264 smbprint.sysv. It contains instructions.
265
266
267 LOCKING
268 =======
269
270 One area which sometimes causes trouble is locking.
271
272 There are two types of locking which need to be performed by a SMB
273 server. The first is "record locking" which allows a client to lock a
274 range of bytes in a open file. The second is the "deny modes" that are
275 specified when a file is open.
276
277 Samba supports "record locking" using the fcntl() unix system
278 call. This is often implemented using rpc calls to a rpc.lockd process
279 running on the system that owns the filesystem. Unfortunately many
280 rpc.lockd implementations are very buggy, particularly when made to
281 talk to versions from other vendors. It is not uncommon for the
282 rpc.lockd to crash.
283
284 There is also a problem translating the 32 bit lock requests generated
285 by PC clients to 31 bit requests supported by most
286 unixes. Unfortunately many PC applications (typically OLE2
287 applications) use byte ranges with the top bit set as semaphore
288 sets. Samba attempts translation to support these types of
289 applications, and the translation has proved to be quite successful.
290
291 Strictly a SMB server should check for locks before every read and
292 write call on a file. Unfortunately with the way fcntl() works this
293 can be slow and may overstress the rpc.lockd. It is also almost always
294 unnecessary as clients are supposed to independently make locking
295 calls before reads and writes anyway if locking is important to
296 them. By default Samba only makes locking calls when explicitly asked
297 to by a client, but if you set "strict locking = yes" then it will
298 make lock checking calls on every read and write. 
299
300 You can also disable by range locking completely using "locking =
301 no". This is useful for those shares that don't support locking or
302 don't need it (such as cdroms). In this case Samba fakes the return
303 codes of locking calls to tell clients that everything is OK.
304
305 The second class of locking is the "deny modes". These are set by an
306 application when it opens a file to determine what types of access
307 should be allowed simultaneously with it's open. A client may ask for
308 DENY_NONE, DENY_READ, DENY_WRITE or DENY_ALL. There are also special
309 compatability modes called DENY_FCB and DENY_DOS.
310
311 You can disable share modes using "share modes = no". This may be
312 useful on a heavily loaded server as the share modes code is very
313 slow. 
314
315
316 MAPPING USERNAMES
317 =================
318
319 If you have different usernames on the PCs and the unix server then
320 take a look at the "username map" option. See the smb.conf man page
321 for details.
322
323
324 OTHER CHARACTER SETS
325 ====================
326
327 If you have problems using filenames with accented characters in them
328 (like the German, French or Scandinavian character sets) then I
329 recommmend you look at the "valid chars" option in smb.conf and also
330 take a look at the validchars package in the examples directory.