Added fixes for become_user braindamage.
[kai/samba.git] / docs / textdocs / DOMAIN.txt
1 Contributor:    Samba Team
2 Updated:        June 27, 1997
3
4 Subject:        Network Logons and Roving Profiles
5 ===========================================================================
6
7 A domain and a workgroup are exactly the same thing in terms of network
8 browsing.  The difference is that a distributable authentication
9 database is associated with a domain, for secure login access to a
10 network.  Also, different access rights can be granted to users if they
11 successfully authenticate against a domain logon server (samba does not
12 support this, but NT server and other systems based on NT server do).
13
14 The SMB client logging on to a domain has an expectation that every other
15 server in the domain should accept the same authentication information.
16 However the network browsing functionality of domains and workgroups is
17 identical and is explained in BROWSING.txt.
18
19 Issues related to the single-logon network model are discussed in this
20 document.  Samba supports domain logons, network logon scripts, and user
21 profiles.  The support is still experimental, but it seems to work.
22
23 The support is also not complete.  Samba does not yet support the sharing
24 of the Windows NT-style SAM database with other systems.  However this is
25 only one way of having a shared user database: exactly the same effect can
26 be achieved by having all servers in a domain share a distributed NIS or
27 Kerberos authentication database.
28
29 When an SMB client in a domain wishes to logon it broadcast requests for a
30 logon server.  The first one to reply gets the job, and validates its
31 password using whatever mechanism the Samba administrator has installed.
32 It is possible (but very stupid) to create a domain where the user
33 database is not shared between servers, ie they are effectively workgroup
34 servers advertising themselves as participating in a domain.  This
35 demonstrates how authentication is quite different from but closely
36 involved with domains.
37
38 Another thing commonly associated with single-logon domains is remote
39 administration over the SMB protocol.  Again, there is no reason why this
40 cannot be implemented with an underlying username database which is
41 different from the Windows NT SAM.  Support for the Remote Administration
42 Protocol is planned for a future release of Samba.
43
44 The domain support works for WfWg, and Win95 clients.  Support for Windows
45 NT and OS/2 clients is still being worked on and is still experimental.
46 Support for profiles is confirmed as working for Win95, NT 4.0 and NT 3.51,
47 although NT Workstation requires manual configuration of user accounts with
48 NT's "User Manager for Domains", and no automatic profile location support
49 is available using samba, although it has been confirmed as possible to use
50 an NT server to specify that the location of profiles is on a samba server.
51
52 The help of an NT server can be enlisted, both for profile storage and
53 for user authentication.  For details on user authentication, see
54 security_level.txt.  For details on profile storage, see below.
55
56
57 Using these features you can make your clients verify their logon via
58 the Samba server, make clients run a batch file when they logon to
59 the network and download their preferences, desktop and start menu.
60
61
62 Configuration Instructions:     Network Logons
63 ==========================================
64
65 To use domain logons and profiles you need to do the following:
66
67
68 1) Setup nmbd and smbd by configuring smb.conf so that Samba is
69    acting as the master browser. See <your OS>_INSTALL.txt and BROWSING.txt
70    for details.
71
72 2) Setup a WINS server (see NetBIOS.txt) and configure all your clients
73    to use that WINS service.  [lkcl 12jul97 - problems occur where
74    clients do not pick up the profiles properly unless they are using a
75    WINS server.  this is still under investigation].
76
77 3) Create a share called [netlogon] in your smb.conf. This share should
78    be readable by all users, and probably should not be writeable. This
79    share will hold your network logon scripts, and the CONFIG.POL file
80    (Note: for details on the CONFIG.POL file, how to use it, what it is,
81    refer to the Microsoft Windows NT Administration documentation.
82    The format of these files is not known, so you will need to use
83    Microsoft tools).
84
85 For example I have used:
86
87    [netlogon]
88     path = /data/dos/netlogon
89     writeable = no
90     guest ok = no
91
92 Note that it is important that this share is not writeable by ordinary
93 users, in a secure environment: ordinary users should not be allowed
94 to modify or add files that another user's computer would then download
95 when they log in.
96
97 4) in the [global] section of smb.conf set the following:
98
99    domain logons = yes
100    logon script = %U.bat
101
102 The choice of batch file is, of course, up to you. The above would
103 give each user a separate batch file as the %U will be changed to
104 their username automatically. The other standard % macros may also be
105 used. You can make the batch files come from a subdirectory by using
106 something like:
107
108    logon script = scripts\%U.bat
109
110 5) create the batch files to be run when the user logs in. If the batch
111    file doesn't exist then no batch file will be run. 
112
113 In the batch files you need to be careful to use DOS style cr/lf line
114 endings. If you don't then DOS may get confused. I suggest you use a
115 DOS editor to remotely edit the files if you don't know how to produce
116 DOS style files under unix.
117
118 6) Use smbclient with the -U option for some users to make sure that
119    the \\server\NETLOGON share is available, the batch files are
120    visible and they are readable by the users.
121
122 7) you will probabaly find that your clients automatically mount the
123    \\SERVER\NETLOGON share as drive z: while logging in. You can put
124    some useful programs there to execute from the batch files.
125
126 NOTE: You must be using "security = user" or "security = server" for
127 domain logons to work correctly.  Share level security won't work
128 correctly.
129
130
131
132 Configuration Instructions:     Setting up Roaming User Profiles
133 ================================================================
134
135 In the [global] section of smb.conf set the following (for example):
136
137   logon path = \\profileserver\profileshare\profilepath\%U\moreprofilepath
138
139 The default for this option is \\%L\%U\profile, namely
140 \\sambaserver\username\profile.  The \\L%\%U services is created
141 automatically by the [homes] service.
142
143 If you are using a samba server for the profiles, you _must_ make the
144 share specified in the logon path browseable.  Windows 95 appears to
145 check that it can see the share and any subdirectories within that share
146 specified by the logon path option, rather than just connecting straight
147 away.  It also attempts to create the components of the full path for
148 you.  If the creation of any component fails, or if it cannot see any
149 component of the path, the profile creation / reading fails.
150
151 [lkcl 26aug96 - we have discovered a problem where Windows clients can
152 maintain a connection to the [homes] share in between logins.  The
153 [homes] share must NOT therefore be used in a profile path.]
154
155
156 Windows 95
157 ----------
158
159 When a user first logs in on Windows 95, the file user.DAT is created,
160 as are folders "Start Menu", "Desktop", "Programs" and "Nethood".  
161 These directories and their contents will be merged with the local
162 versions stored in c:\windows\profiles\username on subsequent logins,
163 taking the most recent from each.  You will need to use the [global]
164 options "preserve case = yes", "short case preserve = yes" and
165 "case sensitive = no" in order to maintain capital letters in shortcuts
166 in any of the profile folders.
167
168 The user.DAT file contains all the user's preferences.  If you wish to
169 enforce a set of preferences, rename their user.DAT file to user.MAN,
170 and deny them write access to this file.
171
172 2) On the Windows 95 machine, go to Control Panel | Passwords and
173    select the User Profiles tab.  Select the required level of
174    roaming preferences.  Press OK, but do _not_ allow the computer
175    to reboot.
176
177 3) On the Windows 95 machine, go to Control Panel | Network |
178    Client for Microsoft Networks | Preferences.  Select 'Log on to
179    NT Domain'.  Then, ensure that the Primary Logon is 'Client for
180    Microsoft Networks'.  Press OK, and this time allow the computer
181    to reboot.
182
183 Under Windows 95, Profiles are downloaded from the Primary Logon.
184 If you have the Primary Logon as 'Client for Novell Networks', then
185 the profiles and logon script will be downloaded from your Novell
186 Server.  If you have the Primary Logon as 'Windows Logon', then the
187 profiles will be loaded from the local machine - a bit against the
188 concept of roaming profiles, if you ask me.
189
190 You will now find that the Microsoft Networks Login box contains
191 [user, password, domain] instead of just [user, password].  Type in
192 the samba server's domain name (or any other domain known to exist,
193 but bear in mind that the user will be authenticated against this
194 domain and profiles downloaded from it, if that domain logon server
195 supports it), user name and user's password.
196
197 Once the user has been successfully validated, the Windows 95 machine
198 will inform you that 'The user has not logged on before' and asks you
199 if you wish to save the user's preferences?  Select 'yes'.
200
201 Once the Windows 95 client comes up with the desktop, you should be able
202 to examine the contents of the directory specified in the "logon path"
203 on the samba server and verify that the "Desktop", "Start Menu",
204 "Programs" and "Nethood" folders have been created.
205
206 These folders will be cached locally on the client, and updated when
207 the user logs off (if you haven't made them read-only by then :-).
208 You will find that if the user creates further folders or short-cuts,
209 that the client will merge the profile contents downloaded with the
210 contents of the profile directory already on the local client, taking
211 the newest folders and short-cuts from each set.
212
213 If you have made the folders / files read-only on the samba server,
214 then you will get errors from the w95 machine on logon and logout, as
215 it attempts to merge the local and the remote profile.  Basically, if
216 you have any errors reported by the w95 machine, check the unix file
217 permissions and ownership rights on the profile directory contents,
218 on the samba server.
219
220
221 If you have problems creating user profiles, you can reset the user's
222 local desktop cache, as shown below.  When this user then next logs in,
223 they will be told that they are logging in "for the first time".
224
225
226 1) instead of logging in under the [user, password, domain] dialog],
227    press escape.
228
229 2) run the regedit.exe program, and look in:
230
231      HKEY_LOCAL_MACHINE\Windows\CurrentVersion\ProfileList
232
233    you will find an entry, for each user, of ProfilePath.  Note the
234    contents of this key (likely to be c:\windows\profiles\username),
235    then delete the key ProfilePath for the required user.
236
237    [Exit the registry editor].
238
239 3) WARNING - before deleting the contents of the directory listed in
240    the ProfilePath (this is likely to be c:\windows\profiles\username),
241    ask them if they have any important files stored on their desktop
242    or in their start menu.  delete the contents of the directory
243    ProfilePath (making a backup if any of the files are needed).
244
245    This will have the effect of removing the local (read-only hidden
246    system file) user.DAT in their profile directory, as well as the
247    local "desktop", "nethood", "start menu" and "programs" folders.
248
249 4) search for the user's .PWL password-cacheing file in the c:\windows
250    directory, and delete it.
251
252 5) log off the windows 95 client.
253
254 6) check the contents of the profile path (see "logon path" described
255    above), and delete the user.DAT or user.MAN file for the user,
256    making a backup if required.  
257
258
259 If all else fails, increase samba's debug log levels to between 3 and 10,
260 and / or run a packet trace program such as tcpdump or netmon.exe, and
261 look for any error reports.
262
263 If you have access to an NT server, then first set up roaming profiles
264 and / or netlogons on the NT server.  Make a packet trace, or examine
265 the example packet traces provided with NT server, and see what the
266 differences are with the equivalent samba trace.
267
268
269 Windows NT Workstation 4.0
270 --------------------------
271
272 When a user first logs in to a Windows NT Workstation, the profile
273 NTuser.MAN is created.  The "User Manager for Domains" can be used
274 to specify the location of the profile.  Samba cannot be a domain
275 logon server for NT, therefore you will need to manually configure
276 each and every account.  [lkcl 10aug97 - i tried setting the path
277 in each account to \\samba-server\homes\profile, and discovered that
278 this fails because a background process maintains the connection to
279 the [homes] share which does _not_ close down in between user logins.
280 you have to have \\samba-server\user\profile, where user is the
281 username created from the [homes] share].
282
283 The entry for the NT 4.0 profile is a _directory_ not a file.  The NT
284 help on profiles mentions that a directory is also created with a .PDS
285 extension.  The user, while logging in, must have write permission to
286 create the full profile path (and the folder with the .PDS extension)
287 [lkcl 10aug97 - i found that the creation of the .PDS directory failed,
288 and had to create these manually for each user, with a shell script.
289 also, i presume, but have not tested, that the full profile path must
290 be browseable just as it is for w95, due to the manner in which they
291 attempt to create the full profile path: test existence of each path
292 component; create path component].
293
294 In the profile directory, NT creates more folders than 95.  It creates
295 "Application Data" and others, as well as "Desktop", "Nethood",
296 "Start Menu" and "Programs".  The profile itself is stored in a file
297 NTuser.DAT.  Nothing appears to be stored in the .PDS directory, and
298 its purpose is currently unknown.
299
300 You can use the System Control Panel to copy a local profile onto
301 a samba server (see NT Help on profiles: it is also capable of firing
302 up the correct location in the System Control Panel for you).  The
303 NT Help file also mentions that renaming NTuser.DAT to NTuser.MAN
304 turns a profile into a mandatory one.
305
306 [lkcl 10aug97 - i notice that NT Workstation tells me that it is
307 downloading a profile from a slow link.  whether this is actually the
308 case, or whether there is some configuration issue, as yet unknown,
309 that makes NT Workstation _think_ that the link is a slow one is a
310 matter to be resolved].
311
312 [lkcl 20aug97 - after samba digest correspondance, one user found, and
313 another confirmed, that profiles cannot be loaded from a samba server
314 unless "security = user" and "encrypted passwords = yes" (see the file
315 ENCRYPTION.txt) or "security = server" and "password server = ip.address.
316 of.yourNTserver" are used.  either of these options will allow the NT
317 workstation to access the samba server using LAN manager encrypted
318 passwords, without the user intervention normally required by NT
319 workstation for clear-text passwords].
320
321 [lkcl 25aug97 - more comments received about NT profiles: the case of
322 the profile _matters_.  the file _must_ be called NTuser.DAT or, for
323 a mandatory profile, NTuser.MAN].
324
325
326 Windows NT Server
327 -----------------
328
329 Following the instructions for NT Workstation, there is nothing to stop
330 you specifying any path that you like for the location of users' profiles.
331 Therefore, you could specify that the profile be stored on a samba server,
332 or any other SMB server, as long as that SMB server supports encrypted
333 passwords.
334
335
336
337 Sharing Profiles between W95 and NT Workstation 4.0
338 ---------------------------------------------------
339
340 The default logon path is \\%L\U%.  NT Workstation will attempt to create
341 a directory "\\samba-server\username.PDS" if you specify the logon path
342 as "\\samba-server\username" with the NT User Manager.  Therefore, you
343 will need to specify (for example) "\\samba-server\username\profile".
344 NT 4.0 will attempt to create "\\samba-server\username\profile.PDS", which
345 is more likely to succeed.
346
347 If you then want to share the same Start Menu / Desktop with W95, you will
348 need to specify "logon path = \\samba-server\username\profile" [lkcl 10aug97
349 this has its drawbacks: i created a shortcut to telnet.exe, which attempts
350 to run from the c:\winnt\system32 directory.  this directory is obviously
351 unlikely to exist on a W95 host].
352
353 If you have this set up correctly, you will find separate user.DAT and
354 NTuser.DAT files in the same profile directory.
355
356 [lkcl 25aug97 - there are some issues to resolve with downloading of
357 NT profiles, probably to do with time/date stamps.  i have found that
358 NTuser.DAT is never updated on the workstation after the first time that
359 it is copied to the local workstation profile directory.  this is in
360 contrast to w95, where it _does_ transfer / update profiles correctly].
361