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