version incremented
[samba] / docs / htmldocs / Samba3-HOWTO / AdvancedNetworkManagement.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 24. Advanced Network Management</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="index.html" title="The Official Samba-3 HOWTO and Reference Guide"><link rel="up" href="optional.html" title="Part III. Advanced Configuration"><link rel="prev" href="winbind.html" title="Chapter 23. Winbind: Use of Domain Accounts"><link rel="next" href="PolicyMgmt.html" title="Chapter 25. System and Account Policies"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 24. Advanced Network Management</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="winbind.html">Prev</a> </td><th width="60%" align="center">Part III. Advanced Configuration</th><td width="20%" align="right"> <a accesskey="n" href="PolicyMgmt.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="AdvancedNetworkManagement"></a>Chapter 24. Advanced Network Management</h2></div><div><div class="author"><h3 class="author"><span class="firstname">John</span> <span class="othername">H.</span> <span class="surname">Terpstra</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email">&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</code></p></div></div></div></div><div><p class="pubdate">June 15 2005</p></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="AdvancedNetworkManagement.html#id2624522">Features and Benefits</a></span></dt><dt><span class="sect1"><a href="AdvancedNetworkManagement.html#id2624549">Remote Server Administration</a></span></dt><dt><span class="sect1"><a href="AdvancedNetworkManagement.html#id2624692">Remote Desktop Management</a></span></dt><dd><dl><dt><span class="sect2"><a href="AdvancedNetworkManagement.html#id2624720">Remote Management from NoMachine.Com</a></span></dt></dl></dd><dt><span class="sect1"><a href="AdvancedNetworkManagement.html#id2625097">Network Logon Script Magic</a></span></dt><dd><dl><dt><span class="sect2"><a href="AdvancedNetworkManagement.html#id2625322">Adding Printers without User Intervention</a></span></dt><dt><span class="sect2"><a href="AdvancedNetworkManagement.html#id2625365">Limiting Logon Connections</a></span></dt></dl></dd></dl></div><p>
2 <a class="indexterm" name="id2624510"></a>
3 This section documents peripheral issues that are of great importance to network
4 administrators who want to improve network resource access control, to automate the user
5 environment, and to make their lives a little easier.
6 </p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2624522"></a>Features and Benefits</h2></div></div></div><p>
7 Often the difference between a working network environment and a well-appreciated one can
8 best be measured by the <span class="emphasis"><em>little things</em></span> that make everything work more
9 harmoniously. A key part of every network environment solution is the ability to remotely
10 manage MS Windows workstations, remotely access the Samba server, provide customized
11 logon scripts, as well as other housekeeping activities that help to sustain more reliable
12 network operations.
13 </p><p>
14 This chapter presents information on each of these areas. They are placed here, and not in
15 other chapters, for ease of reference.
16 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2624549"></a>Remote Server Administration</h2></div></div></div><p>&#8220;<span class="quote">How do I get User Manager and Server Manager?</span>&#8221;</p><p>
17 <a class="indexterm" name="id2624562"></a>
18 <a class="indexterm" name="id2624569"></a>
19 <a class="indexterm" name="id2624576"></a>
20 Since I do not need to buy an <span class="application">NT4 server</span>, how do I get the User Manager for Domains
21 and the Server Manager?
22 </p><p>
23 <a class="indexterm" name="id2624594"></a>
24 <a class="indexterm" name="id2624601"></a>
25 Microsoft distributes a version of these tools called <code class="filename">Nexus.exe</code> for installation 
26 on <span class="application">Windows 9x/Me</span> systems. The tools set includes:
27 </p><div class="itemizedlist"><ul type="disc"><li><p>Server Manager</p></li><li><p>User Manager for Domains</p></li><li><p>Event Viewer</p></li></ul></div><p>
28 Download the archived file at the Microsoft <a href="ftp://ftp.microsoft.com/Softlib/MSLFILES/NEXUS.EXE" target="_top">Nexus</a> link.
29 </p><p>
30 <a class="indexterm" name="id2624655"></a>
31 <a class="indexterm" name="id2624662"></a>
32 <a class="indexterm" name="id2624669"></a>
33 The <span class="application">Windows NT 4.0</span> version of the User Manager for 
34 Domains and Server Manager are available from Microsoft
35 <a href="ftp://ftp.microsoft.com/Softlib/MSLFILES/SRVTOOLS.EXE" target="_top">via ftp</a>.
36 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2624692"></a>Remote Desktop Management</h2></div></div></div><p>
37 <a class="indexterm" name="id2624700"></a>
38 <a class="indexterm" name="id2624707"></a>
39 There are a number of possible remote desktop management solutions that range from free
40 through costly. Do not let that put you off. Sometimes the most costly solution is the
41 most cost effective. In any case, you will need to draw your own conclusions as to which
42 is the best tool in your network environment.
43 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2624720"></a>Remote Management from NoMachine.Com</h3></div></div></div><p>
44         <a class="indexterm" name="id2624729"></a>
45         The following information was posted to the Samba mailing list at Apr 3 23:33:50 GMT 2003.
46         It is presented in slightly edited form (with author details omitted for privacy reasons).
47         The entire answer is reproduced below with some comments removed.
48         </p><p>&#8220;<span class="quote">
49 <a class="indexterm" name="id2624744"></a>
50                 I have a wonderful Linux/Samba server running as PDC for a network. Now I would like to add remote
51                 desktop capabilities so users outside could login to the system and get their desktop up from home or
52                 another country.
53                 </span>&#8221;</p><p>&#8220;<span class="quote">
54 <a class="indexterm" name="id2624760"></a>
55 <a class="indexterm" name="id2624767"></a>
56 <a class="indexterm" name="id2624773"></a>
57 <a class="indexterm" name="id2624780"></a>
58                 Is there a way to accomplish this? Do I need a Windows Terminal server?  Do I need to configure it so
59                 it is a member of the domain or a BDC or PDC? Are there any hacks for MS Windows XP to enable remote login
60                 even if the computer is in a domain?
61                 </span>&#8221;</p><p>
62                 Answer provided: Check out the new offer of &#8220;<span class="quote">NX</span>&#8221; software from
63                 <a href="http://www.nomachine.com/" target="_top">NoMachine</a>.
64                 </p><p>
65 <a class="indexterm" name="id2624810"></a>
66 <a class="indexterm" name="id2624817"></a>
67 <a class="indexterm" name="id2624824"></a>
68         It implements an easy-to-use interface to the Remote X protocol as
69         well as incorporating VNC/RFB and rdesktop/RDP into it, but at a speed
70         performance much better than anything you may have ever seen.
71         </p><p>
72 <a class="indexterm" name="id2624838"></a>
73         Remote X is not new at all, but what they did achieve successfully is
74         a new way of compression and caching technologies that makes the thing
75         fast enough to run even over slow modem/ISDN connections.
76         </p><p>
77 <a class="indexterm" name="id2624851"></a>
78 <a class="indexterm" name="id2624858"></a>
79 <a class="indexterm" name="id2624865"></a>
80 <a class="indexterm" name="id2624872"></a>
81         I test drove their (public) Red Hat machine in Italy, over a loaded
82         Internet connection, with enabled thumbnail previews in KDE konqueror,
83         which popped up immediately on &#8220;<span class="quote">mouse-over</span>&#8221;. From inside that (remote X)
84         session I started a rdesktop session on another, a Windows XP machine.
85         To test the performance, I played Pinball. I am proud to announce
86         that my score was 631,750 points at first try.
87         </p><p>
88 <a class="indexterm" name="id2624891"></a>
89 <a class="indexterm" name="id2624897"></a>
90 <a class="indexterm" name="id2624904"></a>
91 <a class="indexterm" name="id2624911"></a>
92         NX performs better on my local LAN than any of the other &#8220;<span class="quote">pure</span>&#8221;
93         connection methods I use from time to time: TightVNC, rdesktop or
94         Remote X. It is even faster than a direct crosslink connection between
95         two nodes.
96         </p><p>
97 <a class="indexterm" name="id2624928"></a>
98 <a class="indexterm" name="id2624935"></a>
99 <a class="indexterm" name="id2624942"></a>
100         I even got sound playing from the Remote X app to my local boxes, and
101         had a working &#8220;<span class="quote">copy'n'paste</span>&#8221; from an NX  window (running a KDE session
102         in Italy) to my Mozilla mailing agent. These guys are certainly doing
103         something right!
104         </p><p>
105         I recommend test driving NX to anybody with a only a passing interest in remote computing
106         the <a href="http://www.nomachine.com/testdrive.php" target="_top">NX</a> utility.
107         </p><p>
108         Just download the free-of-charge client software (available for Red Hat,
109         SuSE, Debian and Windows) and be up and running within 5 minutes (they
110         need to send you your account data, though, because you are assigned
111         a real UNIX account on their testdrive.nomachine.com box).
112         </p><p>
113         They plan to get to the point were you can have NX application servers
114         running as a cluster of nodes, and users simply start an NX session locally
115         and can select applications to run transparently (apps may even run on
116         another NX node, but pretend to be on the same as used for initial login,
117         because it displays in the same window. You also can run it
118         full-screen, and after a short time you forget that it is a remote session
119         at all).
120         </p><p>
121 <a class="indexterm" name="id2624991"></a>
122         Now the best thing for last: All the core compression and caching
123         technologies are released under the GPL and available as source code
124         to anybody who wants to build on it! These technologies are working,
125         albeit started from the command line only (and very inconvenient to
126         use in order to get a fully running remote X session up and running).
127         </p><p>
128         To answer your questions:
129         </p><div class="itemizedlist"><ul type="disc"><li><p>
130                 You do not need to install a terminal server; XP has RDP support built in.
131                 </p></li><li><p>
132                 NX is much cheaper than Citrix  and comparable in performance, probably faster.
133                 </p></li><li><p>
134                 You do not need to hack XP  it just works.
135                 </p></li><li><p>
136                 You log into the XP box from remote transparently (and I think there is no
137                 need to change anything to get a connection, even if authentication is against a domain).
138                 </p></li><li><p>
139                 The NX core technologies are all Open Source and released under the GPL 
140                 you can now use a (very inconvenient) command line at no cost,
141                 but you can buy a comfortable (proprietary) NX GUI front end for money.
142                 </p></li><li><p>
143 <a class="indexterm" name="id2625055"></a>
144 <a class="indexterm" name="id2625061"></a>
145 <a class="indexterm" name="id2625068"></a>
146 <a class="indexterm" name="id2625074"></a>
147 <a class="indexterm" name="id2625081"></a>
148                 NoMachine is encouraging and offering help to OSS/Free Software implementations
149                 for such a front-end too, even if it means competition to them (they have written
150                 to this effect even to the LTSP, KDE, and GNOME developer mailing lists).
151                 </p></li></ul></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2625097"></a>Network Logon Script Magic</h2></div></div></div><p>
152 There are several opportunities for creating a custom network startup configuration environment.
153 </p><div class="itemizedlist"><ul type="disc"><li><p>No Logon Script.</p></li><li><p>Simple universal Logon Script that applies to all users.</p></li><li><p>Use of a conditional Logon Script that applies per-user or per-group attributes.</p></li><li><p>Use of Samba's preexec and postexec functions on access to the NETLOGON share to create
154                 a custom logon script and then execute it.</p></li><li><p>User of a tool such as KixStart.</p></li></ul></div><p>
155 The Samba source code tree includes two logon script generation/execution tools.
156 See <code class="filename">examples</code> directory <code class="filename">genlogon</code> and
157 <code class="filename">ntlogon</code> subdirectories.
158 </p><p>
159 The following listings are from the genlogon directory.
160 </p><p>
161 <a class="indexterm" name="id2625167"></a>
162 This is the <code class="filename">genlogon.pl</code> file:
163
164 </p><pre class="programlisting">
165         #!/usr/bin/perl
166         #
167         # genlogon.pl
168         #
169         # Perl script to generate user logon scripts on the fly, when users
170         # connect from a Windows client. This script should be called from 
171         # smb.conf with the %U, %G and %L parameters. I.e:
172         #
173         #       root preexec = genlogon.pl %U %G %L
174         #
175         # The script generated will perform
176         # the following:
177         #
178         # 1. Log the user connection to /var/log/samba/netlogon.log
179         # 2. Set the PC's time to the Linux server time (which is maintained
180         #    daily to the National Institute of Standards Atomic clock on the
181         #    internet.
182         # 3. Connect the user's home drive to H: (H for Home).
183         # 4. Connect common drives that everyone uses.
184         # 5. Connect group-specific drives for certain user groups.
185         # 6. Connect user-specific drives for certain users.
186         # 7. Connect network printers.
187
188         # Log client connection
189         #($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
190         ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
191         open LOG, "&gt;&gt;/var/log/samba/netlogon.log";
192         print LOG "$mon/$mday/$year $hour:$min:$sec";
193         print LOG " - User $ARGV[0] logged into $ARGV[1]\n";
194         close LOG;
195
196         # Start generating logon script
197         open LOGON, "&gt;/shared/netlogon/$ARGV[0].bat";
198         print LOGON "\@ECHO OFF\r\n";
199
200         # Connect shares just use by Software Development group
201         if ($ARGV[1] eq "SOFTDEV" || $ARGV[0] eq "softdev")
202         {
203                 print LOGON "NET USE M: \\\\$ARGV[2]\\SOURCE\r\n";
204         }
205
206         # Connect shares just use by Technical Support staff
207         if ($ARGV[1] eq "SUPPORT" || $ARGV[0] eq "support")
208         {
209                 print LOGON "NET USE S: \\\\$ARGV[2]\\SUPPORT\r\n";
210         }
211
212         # Connect shares just used by Administration staff
213         If ($ARGV[1] eq "ADMIN" || $ARGV[0] eq "admin")
214         {
215                 print LOGON "NET USE L: \\\\$ARGV[2]\\ADMIN\r\n";
216                 print LOGON "NET USE K: \\\\$ARGV[2]\\MKTING\r\n";
217         }
218
219         # Now connect Printers. We handle just two or three users a little
220         # differently, because they are the exceptions that have desktop
221         # printers on LPT1: - all other user's go to the LaserJet on the
222         # server.
223         if ($ARGV[0] eq 'jim'
224             || $ARGV[0] eq 'yvonne')
225         {
226                 print LOGON "NET USE LPT2: \\\\$ARGV[2]\\LJET3\r\n";
227                 print LOGON "NET USE LPT3: \\\\$ARGV[2]\\FAXQ\r\n";
228         }
229         else
230         {
231                 print LOGON "NET USE LPT1: \\\\$ARGV[2]\\LJET3\r\n";
232                 print LOGON "NET USE LPT3: \\\\$ARGV[2]\\FAXQ\r\n";
233         }
234
235         # All done! Close the output file.
236         close LOGON;
237 </pre><p>
238 </p><p>
239 Those wishing to use a more elaborate or capable logon processing system should check out these sites:
240 </p><div class="itemizedlist"><ul type="disc"><li><p><a href="http://www.craigelachie.org/rhacer/ntlogon" target="_top">http://www.craigelachie.org/rhacer/ntlogon</a></p></li><li><p><a href="http://www.kixtart.org" target="_top">http://www.kixtart.org</a></p></li></ul></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2625322"></a>Adding Printers without User Intervention</h3></div></div></div><p>
241 <a class="indexterm" name="id2625330"></a>
242 Printers may be added automatically during logon script processing through the use of:
243 </p><pre class="screen">
244 <code class="prompt">C:\&gt; </code><strong class="userinput"><code>rundll32 printui.dll,PrintUIEntry /?</code></strong>
245 </pre><p>
246
247 See the documentation in the <a href="http://support.microsoft.com/default.asp?scid=kb;en-us;189105" target="_top">Microsoft Knowledge Base article 189105</a>.
248 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2625365"></a>Limiting Logon Connections</h3></div></div></div><p>
249                 Sometimes it is necessary to limit the number of concurrent connections to a
250                 Samba shared resource. For example, a site may wish to permit only one network
251                 logon per user.
252         </p><p>
253                 The Samba <em class="parameter"><code>preexec script</code></em> parameter can be used to permit only one
254                 connection per user. Though this method is not foolproof and may have side effects,
255                 the following contributed method may inspire someone to provide a better solution.
256         </p><p>
257                 This is not a perfect solution because Windows clients can drop idle connections
258                 with an auto-reconnect capability that could result in the appearance that a share
259                 is no longer in use, while actually it is. Even so, it demonstrates the principle
260                 of use of the <em class="parameter"><code>preexec script</code></em> parameter.
261         </p><p>
262                 The following share configuration demonstrates use of the script shown in <a href="AdvancedNetworkManagement.html#Tpees" title="Example 24.1. Script to Enforce Single Resource Logon">???</a>.
263 </p><pre class="programlisting">
264 [myshare]
265         ...
266         preexec script = /sbin/PermitSingleLogon.sh
267         preexec close = Yes
268         ...
269 </pre><p>
270         </p><div class="example"><a name="Tpees"></a><p class="title"><b>Example 24.1. Script to Enforce Single Resource Logon</b></p><pre class="screen">
271 #!/bin/bash
272
273 IFS="-"
274 RESULT=$(smbstatus -S -u $1 2&gt; /dev/null | awk 'NF \
275         &gt; 6 {print $1}' | sort | uniq -d)
276
277 if [ "X${RESULT}" == X  ]; then
278   exit 0
279 else
280   exit 1
281 fi
282 </pre></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="winbind.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="optional.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="PolicyMgmt.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 23. Winbind: Use of Domain Accounts </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 25. System and Account Policies</td></tr></table></div></body></html>