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