Samba 3.0.2

Preparation
- Perform this stage using your functioning PC.
- Download the Samba source code from www.samba.org.
- Visit www.samba.org and click on the link for your closest mirror.
- Click on the link named "download".
- Click on the link for the source code of the latest version of Samba. You will need the source code in
.tar.gzformat. The file is calledsamba-latest.tar.gz. - You will be asked to where you wish to save the file. Chose a safe place and make a note of it.
- The download is about 10Mb and will take at least half an hour over a modem, but a lot less over a broadband connection.
- If you are using a download accelerator program, it will save the file to your default download directory.
- Burn the file
samba-latest.tar.gzto a CD. This page assumes that the subdirectory/appsis used for the.tar.gzfile. The CD-ROM can be a multi-session disk.- Use your CD burning software to create an ISO9660 disc image with the file
samba-latest.tar.gzin the/appsdirectory. - Burn the CD and verify the data stored on it.
- Use your CD burning software to create an ISO9660 disc image with the file
Booting
- Perform this stage and subsequent stages, unless otherwise stated, using your Core Linux PC.
- Boot your Core Linux PC.
- Login as
root. You will need to enter the password at the prompt.- Wait for the following text to appear:
localhost login: - Type
rootand press Enter. - The screen will display this message:
Password: - Enter the password for
rootthat you set earlier. - You will be shown a prompt that looks like this:
[~]#
- Wait for the following text to appear:
Extract the source
- Place the CD-R in the CD-ROM drive. Mount the CD-ROM drive under
/mnt/cdrom.- At the prompt enter:
mount /dev/hdb /mnt/cdrom - You will see the following line appear:
mount: block device /dev/hdb is write-protected, mounting read-only
- At the prompt enter:
- Change to the
/appsdirectory on the CD-R.- At the prompt enter:
cd /mnt/cdrom/apps - The prompt will change to:
[/mnt/cdrom/apps]#
- At the prompt enter:
- Copy the
samba-latest.tar.gzfile to the directory/usr/src.- At the prompt enter:
cp samba-latest.tar.gz /usr/src - The system will not display a message if everything is OK.
- At the prompt enter:
- Change to the
/usr/srcdirectory and extract the source from the.tar.gzfile.- At the prompt enter:
cd /usr/src - The prompt will change to:
[/usr/src]# - At the prompt enter:
tar -zxvf samba-latest.tar.gz - A long stream of unzipping files and directories should scroll up the screen for about thirty seconds.
- At the prompt enter:
Configure and compile Samba
- The
.tar.gzfile will have been decompressed to a directory calledsamba-x.x.xwherex.x.xis the version number of the Samba source code. The version detailed here is Samba 3.0.2a. Change to the/usr/src/samba-3.0.2a/sourcedirectory.- At the prompt enter:
cd samba-3.0.2a/source - The prompt will change to:
[/usr/src/samba-3.0.2a/source]#
- At the prompt enter:
- Run the
./configurescript.- At the prompt enter:
./configure - N.B. If you wish the software to be installed in a directory other than the default directory of
/usr/local/sambathen use the alternative command:where the word./configure --prefix=PREFIXPREFIXis replaced by your alternative directory path. - A long stream of processes should scroll up the screen for about three mintues.
- The script finishes with the line:
config.status: creating include/config.h
- At the prompt enter:
- Run the
makeprogram.- At the prompt enter:
make - A long stream of processes should scroll up the screen for about twenty mintues.
- The program finishes with the line:
Building plugin bin/CP437.so
- At the prompt enter:
- Run the
makeprogram with the argumentinstall.- At the prompt enter:
make install - A long stream of processes should scroll up the screen for about thirty seconds.
- The program finishes with the lines:
/usr/bin/ginstall -c /usr/src/samba-3.0.2a/source/include/libsmbclient.h //usr/local/samba/include
- At the prompt enter:
Setting up Samba
- These stages demonstrate a simple Samba configuration. There are many books or online guides detailing how to configure Samba's more advanced features. This setup is not highly secure, and should be used to establish that the software is correctly installed and can be accessed from your test machine.
- Change to the
/usr/local/samba/libdirectory.- At the prompt enter:
cd /usr/local/samba/lib - The prompt will change to:
[/usr/local/samba/lib]#
- At the prompt enter:
- Edit the
smb.conffile.- At the prompt enter:
nano smb.conf - The screen will show the contents of
smb.confwith information about the file at the top and bottom of the screen. The file is empty. - Navigate the file using the arrow keys.
- At the prompt enter:
- Enter the text below as a basic Samba configuration. You may replace the value of the variable
workgroupwith your own workgroup name.[global]
workgroup = SIMPLE
netbios name = Core
security = share
guest ok = yes
guest account = samba
[test]
path = /home/samba/test
read only = no - Save the file and exit the text editor.
- Press Ctrl+x on the keyboard.
- The contents of the white line at the bottom of the screen will change to read:
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? - Type
y. - The contents of the white line at the bottom of the screen will change to read:
File Name to write: smb.conf - Press Enter.
- You will be returned to the system prompt.
- Create the directory
/home/samba/test.- At the prompt enter:
mkdir -p /home/samba/test - The system will not display a message if everything is OK.
- At the prompt enter:
- Change the access permissions of the
/home/samba/testdirectory to 0777. Although this is an insecure state to leave a folder, this is only for the purposes of testing.- At the prompt enter:
chmod 0777 /home/samba/test - The system will not display a message if everything is OK.
- At the prompt enter:
- Test the syntax of your
smb.conffile using thetestparmtool.- At the prompt enter:
/usr/local/samba/bin/testparm - The following text will appear if the syntax of your
smb.conffile is OK:When you press enter a full list of the definitions with which Samba will run will scroll up the screen. This includes every setting which doesn't appear in theLoad smb config files from /usr/local/samba/lib/smb.conf
Processing section "[test]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitionsmb.conffile and so is left at the default value. After the listing is complete you are returned to the system prompt.
- At the prompt enter:
- Add the user
samba.- At the prompt enter:
useradd samba - The system will not display a message if everything is OK.
- At the prompt enter:
Starting Samba
- Start the
smbdandnmbddaemons with the argument-D.- At the prompt enter:
/usr/local/samba/sbin/smbd -D - The system will not display a message if everything is OK.
- At the prompt enter:
/usr/local/samba/sbin/nmbd -D - The system will not display a message if everything is OK.
- At the prompt enter:
Testing Samba
- At the prompt enter:
/usr/local/samba/bin/smbclient -L Core - The screen will display the following message:
Password: - At the prompt, enter your root password.
- The system will display the following message:
There may be other machines listed under the
Domain=[SIMPLE] OS=[Unix] Server=[Samba 3.0.2a]
Sharename Type Comment
--------- ---- -------
test Disk
IPC$ IPC IPC Service (Samba 3.0.2a)
ADMIN$ Disk IPC Service (Samba 3.0.2a)
Server Comment
---------- -------
CORE Samba 3.0.2a
Workgroup Master
--------- -------
SIMPLE COREServersection if you have other computers running SMB servers in the same workgroup as your Core Linux PC. Also, the master browser may be different from that listed in theMastersection. - Assuming you saw no error messages you have correctly installed and configured Samba. Try to access the Samba server using
smbclientor another SMB application on your other PC.
Stopping Samba
- Stop the Samba servers using
killand remove the PID files.- At the prompt enter:
kill `cat /usr/local/samba/var/locks/smbd.pid` - The system will not display a message if everything is OK.
- At the prompt enter:
kill `cat /usr/local/samba/var/locks/nmbd.pid` - The system will not display a message if everything is OK.
- At the prompt enter:
rm /usr/local/samba/var/locks/smbd.pid - The system will display the following message:
rm: remove `/usr/local/samba/var/locks/smbd.pid`? - Press
yfollowed by Enter to delete the file. - The system will not display a message if everything is OK.
- At the prompt enter:
rm /usr/local/samba/var/locks/nmbd.pid - The system will display the following message:
rm: remove `/usr/local/samba/var/locks/nmbd.pid`? - Press
yfollowed by Enter to delete the file. - The system will not display a message if everything is OK.
- At the prompt enter:
Automating Samba
- This section details how to have your Samba server start automatically when the computer boots. The advantage of this method is that you do not have to log in to start Samba. If you wish to start Samba manually after each reboot then skip this section.
- Append the following lines to the
/etc/rc.d/rc.muscript:You can also add comments and echoes for your own information./usr/local/samba/sbin/smbd -D
/usr/local/samba/sbin/nmbd -D- At the prompt enter:
nano /etc/rc.d/rc.mu - The screen will show the contents of
/etc/rc.d/rc.muwith information about the file at the top and bottom of the screen. - Add the following text to the end of the file:
# Start Samba
/usr/local/samba/bin/smbd -D
echo smbd Started
/usr/local/samba/bin/nmbd -D
echo nmbd Started - Save the file and exit the text editor.
- Press Ctrl+x on the keyboard.
- The contents of the white line at the bottom of the screen will change to read:
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? - Type
y. - The contents of the white line at the bottom of the screen will change to read:
File Name to write: /etc/rc.d/rc.mu - Press Enter.
- You will be returned to the system prompt.
- At the prompt enter:
- Insert the following lines at the second line of the
/etc/rc.d/rc.hascript:You can also add comments and echoes for your own information.kill `cat /usr/local/samba/var/locks/smbd.pid`
rm -f /usr/local/samba/var/locks/smbd.pid
kill `cat /usr/local/samba/var/locks/nmbd.pid`
rm -f /usr/local/samba/var/locks/nmbd.pid- At the prompt enter:
nano /etc/rc.d/rc.ha - The screen will show the contents of
/etc/rc.d/rc.hawith information about the file at the top and bottom of the screen. - Insert the following text at the second line of the file:
# Stop Samba
kill `cat /usr/local/samba/var/locks/smbd.pid`
rm -f /usr/local/samba/var/locks/smbd.pid
echo smbd Stopped kill `cat /usr/local/samba/var/locks/nmbd.pid`
rm -f /usr/local/samba/var/locks/nmbd.pid
echo nmbd Stopped - Save the file and exit the text editor.
- Press Ctrl+x on the keyboard.
- The contents of the white line at the bottom of the screen will change to read:
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? - Type
y. - The contents of the white line at the bottom of the screen will change to read:
File Name to write: /etc/rc.d/rc.ha - Press Enter.
- You will be returned to the system prompt.
- At the prompt enter:
- Reboot the system and check that Samba is running.
- At the system prompt enter:
shutdown -r now - Wait for the system to reboot.
- As the system reboots, watch for any error messages.
- Once the system has rebooted, try to access the Samba server using
smbclientor another SMB application on your other PC.
- At the system prompt enter:

The text of this page is licensed under a Creative Commons License.
