1 | <sect2>
|
---|
2 | <title>Configuring Samba</title>
|
---|
3 | <para>We will configure one Samba server (SAMBABOX) to act as a primary
|
---|
4 | domain controller, as well as configure one domain client running
|
---|
5 | Windows 2000 Server(WIN2KBOX) and acting as a member server of the
|
---|
6 | domain. Detailed instructions will be given for adding WIN2KBOX to
|
---|
7 | the domain due to the extra steps necessary. Instructions for adding
|
---|
8 | Windows 95/98/XP clients can be found in the newly installed
|
---|
9 | documentation by pointing a web browser to:</para>
|
---|
10 |
|
---|
11 | <para><screen><userinput>file:///usr/share/samba/swat/using_samba/ch03_01.html#ch03-55770.</userinput></screen></para>
|
---|
12 |
|
---|
13 | <sect3><title>Config files</title>
|
---|
14 | <para><userinput>/etc/samba/smb.conf, /etc/rc.d/init.d/samba </userinput></para>
|
---|
15 |
|
---|
16 | <para>First we set up some directories needed by Samba:</para>
|
---|
17 | <para><screen><userinput>mkdir /var/lib/samba &&
|
---|
18 | mkdir /var/lib/samba/netlogon &&
|
---|
19 | mkdir /var/lib/samba/ntprofile &&
|
---|
20 | mkdir /var/lib/samba/profiles &&
|
---|
21 | chmod -R 1777 /var/lib/samba</userinput></screen></para>
|
---|
22 |
|
---|
23 | <para>And the Samba configuration file: </para>
|
---|
24 | <para><screen><userinput>cat > /etc/samba/smb.conf << "EOF"
|
---|
25 | [global]
|
---|
26 | netbios name = SAMBABOX
|
---|
27 | workgroup = DOMAIN01
|
---|
28 | os level = 64
|
---|
29 | preferred master = yes
|
---|
30 | domain master = yes
|
---|
31 | local master = yes
|
---|
32 | security = user
|
---|
33 | encrypt passwords = yes
|
---|
34 | domain logons = yes
|
---|
35 | log file = /var/log/log.%m
|
---|
36 | log level = 1
|
---|
37 | logon path = \\%N\home\%u
|
---|
38 | logon drive = H:
|
---|
39 | logon home = \\homeserver\%u
|
---|
40 | logon script = logon.cmd
|
---|
41 | [netlogon]
|
---|
42 | path = /var/lib/samba/netlogon
|
---|
43 | read only = yes
|
---|
44 | write list = ntadmin
|
---|
45 | [profiles]
|
---|
46 | path = /var/lib/samba/ntprofile
|
---|
47 | read only = no
|
---|
48 | create mask = 0600
|
---|
49 | directory mask = 0700
|
---|
50 | ; World writable share for testing
|
---|
51 | [tmp]
|
---|
52 | comment = Temporary file space
|
---|
53 | path = /tmp
|
---|
54 | read only = no
|
---|
55 | public = yes
|
---|
56 | [home]
|
---|
57 | comment = Users' home directories
|
---|
58 | path = /home
|
---|
59 | read only = no
|
---|
60 | public = no
|
---|
61 | EOF </userinput></screen></para>
|
---|
62 |
|
---|
63 | <para>Now add the machine trust account for WIN2KBOX:</para>
|
---|
64 | <para><screen><userinput>/usr/sbin/useradd -g 100 -d /dev/null -c \
|
---|
65 | "machine nickname" -s /bin/false win2kbox$ &&
|
---|
66 | passwd -l win2kbox$ &&
|
---|
67 | smbpasswd -a -m win2kbox</userinput></screen></para>
|
---|
68 |
|
---|
69 | <para>Create the Samba boot script:</para>
|
---|
70 | <para><screen><userinput>cat > /etc/rc.d/init.d/samba << "EOF"
|
---|
71 | #!/bin/bash
|
---|
72 | # Begin $rc_base/init.d/samba
|
---|
73 | # Based on sysklogd script from LFS-3.1 and earlier.
|
---|
74 | # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
|
---|
75 | source /etc/sysconfig/rc
|
---|
76 | source $rc_functions
|
---|
77 | case "$1" in
|
---|
78 | start)
|
---|
79 | echo "Starting nmbd..."
|
---|
80 | loadproc /usr/sbin/nmbd -D
|
---|
81 | echo "Starting smbd..."
|
---|
82 | loadproc /usr/sbin/smbd -D
|
---|
83 | ;;
|
---|
84 | stop)
|
---|
85 | echo "Stopping smbd..."
|
---|
86 | killproc /usr/sbin/smbd
|
---|
87 | echo "Stopping nmbd..."
|
---|
88 | killproc /usr/sbin/nmbd
|
---|
89 | ;;
|
---|
90 | reload)
|
---|
91 | echo "Reloading smbd..."
|
---|
92 | reloadproc /usr/sbin/smbd
|
---|
93 | echo "Reloading nmbd..."
|
---|
94 | reloadproc /usr/sbin/nmbd
|
---|
95 | ;;
|
---|
96 | restart)
|
---|
97 | $0 stop
|
---|
98 | sleep 1
|
---|
99 | $0 start
|
---|
100 | ;;
|
---|
101 | status)
|
---|
102 | statusproc /usr/sbin/nmbd
|
---|
103 | statusproc /usr/sbin/smbd
|
---|
104 | ;;
|
---|
105 | *)
|
---|
106 | echo "Usage: $0 {start|stop|reload|restart|status}"
|
---|
107 | exit 1
|
---|
108 | ;;
|
---|
109 | esac
|
---|
110 | # End $rc_base/init.d/samba
|
---|
111 | EOF</userinput></screen></para>
|
---|
112 | <para>Add the run level symlinks:</para>
|
---|
113 | <para><screen><userinput>chmod 754 /etc/rc.d/init.d/samba &&
|
---|
114 | ln -s /etc/rc.d/init.d/samba /etc/rc.d/rc0.d/K48samba &&
|
---|
115 | ln -s /etc/rc.d/init.d/samba /etc/rc.d/rc1.d/K48samba &&
|
---|
116 | ln -s /etc/rc.d/init.d/samba /etc/rc.d/rc2.d/K48samba &&
|
---|
117 | ln -s /etc/rc.d/init.d/samba /etc/rc.d/rc3.d/S24samba &&
|
---|
118 | ln -s /etc/rc.d/init.d/samba /etc/rc.d/rc4.d/S24samba &&
|
---|
119 | ln -s /etc/rc.d/init.d/samba /etc/rc.d/rc5.d/S24samba &&
|
---|
120 | ln -s /etc/rc.d/init.d/samba /etc/rc.d/rc6.d/K48samba</userinput></screen></para>
|
---|
121 |
|
---|
122 | <para>Now, we'll use our new boot script to start Samba: </para>
|
---|
123 | <para><screen><userinput>/etc/rc.d/init.d/samba start</userinput></screen></para>
|
---|
124 | <para>We have to add the SAMBABOX root account to the Samba user list
|
---|
125 | first in order to join WIN2KBOX to the DOMAIN01 domain: </para>
|
---|
126 |
|
---|
127 | <para><screen><userinput>smbpasswd -a root</userinput></screen></para>
|
---|
128 |
|
---|
129 | <para>After starting Samba and adding root to the Samba user list, the
|
---|
130 | first machine we'll join to DOMAIN01 will be WIN2KBOX, the Windows
|
---|
131 | 2000 Server box we created the machine trust account for. On
|
---|
132 | WIN2KBOX:</para><para><screen><userinput>
|
---|
133 |
|
---|
134 | 1. Right click on My Computer.
|
---|
135 | 2. Click on Properties.
|
---|
136 | 3. Click on the Network Identification notebook tab.
|
---|
137 | 4. Click on the Properties button.
|
---|
138 | 5. In the Computer Name: edit field enter WIN2KBOX.
|
---|
139 | 6. Click on the Domain: radio button and enter DOMAIN01 in the edit
|
---|
140 | field and click OK.
|
---|
141 | 7. When presented with the Domain Username And Password dialog box,
|
---|
142 | enter root and root's password on SAMBABOX and click OK.
|
---|
143 | 8. After the machine trust is negotiated, click the OK button in the
|
---|
144 | dialog box welcoming you to the DOMAIN01 domain.
|
---|
145 | 9. Click OK in the reboot reminder dialog box.
|
---|
146 | 10. Click OK to close the System Properties window.
|
---|
147 | 11. Click Yes to reboot WIN2KBOX. </userinput></screen></para></sect3>
|
---|
148 |
|
---|
149 | <sect3><title>Add a new user to the DOMAIN01 domain.</title>
|
---|
150 | <para>Before logging on to WIN2KBOX, we will create a new user with
|
---|
151 | the following commands:</para>
|
---|
152 | <para><screen><userinput>useradd -m win2kuser01 &&
|
---|
153 | passwd win2kuser01 &&
|
---|
154 | smbpasswd -a win2kuser01</userinput></screen></para></sect3>
|
---|
155 |
|
---|
156 | <sect3><title>Logging on to DOMAIN01.</title>
|
---|
157 | <para>Now we will log on the the domain as our newly created user as
|
---|
158 | follows:</para>
|
---|
159 | <para><screen><userinput>1. Press Ctrl-Alt-Del to bring up the Log On to Windows dialog box.
|
---|
160 | 2. Enter the win2kuser01 name and password.
|
---|
161 | 3. Select DOMAIN01 from the Log on to: combination box and click OK.</userinput></screen></para>
|
---|
162 |
|
---|
163 | <para>Add the swat entry to <filename>/etc/services</filename>with the
|
---|
164 | following command: </para>
|
---|
165 |
|
---|
166 | <para><screen><userinput>echo "swat 901/tcp" >> /etc/services</userinput></screen></para>
|
---|
167 |
|
---|
168 | <para>If inetd is used, the following command will add the swat entry
|
---|
169 | to <filename>/etc/inetd.conf</filename>: </para>
|
---|
170 | <para><screen><userinput>echo "swat stream tcp nowait.400 root /usr/sbin/swat swat" \
|
---|
171 | >> /etc/inetd.conf</userinput></screen></para>
|
---|
172 |
|
---|
173 | <para>If xinetd is used, the following command will add the swat entry
|
---|
174 | to <filename>/etc/xinetd.conf</filename>: </para>
|
---|
175 | <para><screen><userinput>cat >> /etc/xinetd.conf << "EOF"
|
---|
176 | service swat
|
---|
177 | {
|
---|
178 | port = 901
|
---|
179 | socket_type = stream
|
---|
180 | wait = no
|
---|
181 | only_from = 127.0.0.1
|
---|
182 | user = root
|
---|
183 | server = /usr/sbin/swat
|
---|
184 | log_on_failure += USERID
|
---|
185 | }
|
---|
186 | EOF</userinput></screen></para>
|
---|
187 |
|
---|
188 | <para>The Samba Web Administration Tool, swat, can be launched with the
|
---|
189 | following command on SAMBABOX: </para>
|
---|
190 | <para><screen><userinput>lynx http://localhost:901 </userinput></screen></para>
|
---|
191 | <note><para>Be sure inetd is running, and issue a killall -HUP inetd
|
---|
192 | before starting swat.</para></note>
|
---|
193 | <para>The lynx browser is used in this demonstration, but is not
|
---|
194 | necessary.</para></sect3>
|
---|
195 |
|
---|
196 | </sect2>
|
---|
197 |
|
---|