Simple Simon Samba HOW TO
Jerry Winegarden
Last Revised: 10/19/00
Samba - what it is
Samba is an open sources package that provides SMB file and print service for
Microsoft Networking (Network Neighborhood). This is the server part.
It allows your Linux box to be accessed through Network Neighborhood by
machines running Microsoft Windows (3.x,9X,ME,NT,2000). It allows your
machine to even become an NT Domain server, just like Microsoft Windows
NT servers, if you so desire. However, this document is intended to explain
how to install and configure samba for simple file and printer sharing to
Windows 95/98 machines as if your machine was running MS Windows 98.
There are other packages that provide the client part, the most common
is called "Gnomba". Gnomba allows you to access files from machines
running Microsoft Windows 95/98 through Network Neighborhood as if you
were running Win 98. For information on how to obtain/install gnomba,
please see: Obtaining and Installing Gnomba HOW TO.
To access files or printers from your samba server, PC's must have installed
"Client for Microsoft Networks", which is the case if "Network Neighborhood"
icon shows up on your desktop. To install "Client for Microsoft Networks",
please see:
File Sharing with Microsoft Windows HOW TO.
Obtaining Samba
Samba is included as a regular part of the Red Hat Linux distribution. You
will find it and updates with the rest of the regular RH RPMS and updates.
Samba comes from www.samba.org.
Installing Samba
If you have the rpm file for samba (and it's not already installed or you
want to install an update), then use the command: rpm -Uvh samba*.
Samba configuration files are now in /etc/samba. In particular, the main
samba configuration file is: /etc/samba/smb.conf. To start up samba for a
simple trial, there are only a few changes to make. How much work you
have to do after that depends on what how many directories you want to
share and how you want to share them.
Quick samba configuration (for simple operations and quick testing)
You will need to change a few lines in the samba configuration file,
/etc/samba/smb.conf. In this file, lines starting with # or ; are comments.
To "uncomment" a line, simply remove the leading # or ; and to "comment out"
a line, simply insert a #.
Change the following lines in /etc/samba/smb.conf:
- workgroup = Your_workgroup_name
(e.g. workgroup = YORK if you are in a dorm named York and you want to show up
with other machines in the workgroup you all call "YORK".)
- hosts allow = a.b. a.c.
where a,b are the first two numbers of your machine's IP number, and
a,c may be the first two numbers of other machines at Duke from which you
may want to allow access. Notice the trailing "."; this is important.
"a.b." means "a.b.*.*", so any machine with IP number which started with
a.b will be allowed. Notice also the space with no comma separating the
two entries "a.b." and "a.c."; this is how you specify more than one range of
IP numbers.
Note: this line is commented out. If you uncomment it and change the
IP numbers to those above, you will allow ALL machines with IP numbers
in the specified range to POSSIBLY have access to files on your server.
For a quick test of whether you have samba running, you do NOT need to
uncomment or change this line. If your server is not behind your own
firewall, then using this line is a good idea.
- encrypt passwords = yes
Note: if access is only from Win 98 (or the most recent version of Win95)
or from WinNT/2000 clients, then you should ENCRYPT = yes. If you have
only older Win 95 clients, you should leave this line COMMENTED OUT
(; encrypt password = yes) (or change it to = no). If you have a mixture
of Win 98 and old Win 95 boxes, then you will have to decide which ones
to serve, or to NOT ENCRYPT, and change the Win 98 boxes to stop encrypting
passwords. If you are NOT behind your a firewall, this is not necessarily
a good idea to not encrypt passwords.
(Duke University and the dorm network are not behind a firewall. )
Instructions on how to disable password encryption on a MS Windows 98 box
are available from:
MS Windows Password Encryption
- unix password sync = Yes
This will allow your samba users password file (/etc/samba/smbpasswd)
and your unix users password file (/etc/passwd) to remain synchronized
(i.e. changing samba password will cause the unix password to be changed).
The resulting samba configuration will then allow:
- "User-level" access
- all printers listed in /etc/printcap will be shared
- your group name for Network Neighborhood will be what you set in the
"workgroup =" line
- your machine name in Network Neighborhood will be your TCP/IP host name
(for example: w-x-y-z.dorm.duke.edu, whatever the value /bin/hostname shows).
- Access to all files in Linux home directory /home/someusername IF:
- Linux user account created
- Use "useradd" and "passwd" commands to create
/home/someusername directory, someusername entry in /etc/passwd file, and
password set for someusername.
- For instructions in creating user accounts,
please see:
- user is logged into an MS Windows 98 machine with exactly that same
username (here shown as"someusername") and password.
Starting up samba services
To provide smb services, you must run TWO processes: smbd and nmbd>.
To start up smbd, you should find an entry in /etc/rc.d/init.d, so that you
can simply say: /etc/rc.d/init.d/smbd start. This should also start the
other process: nmbd. To see if they are running: ps aux | grep smbd,
ps aux | grep nmbd. You can start up smbd and nmbd by hand (to test), or
you can make samba start up automatically with system start up.
Three ways to start up samba
- /etc/rc.d/init.d/samba start (also "stop" or "restart" or "status")
- /usr/sbin/smbd; /usr/sbin/nmbd (start "by hand")
- Use linuxconf to configure smbd to start on system boot up
Using linuxconf to configure samba to start up automatically
==>/sbin/linuxconf ==>Control ==>Control service activity
(from the embedded window on right, scroll down to find choice of
service to control)
==>smb (smbd is not listed, nor is nmbd. choosing smb will configure both
smbd and nmbd to start up automatically)
(from the "Basic info" section, buttons for "Automatic", "Start" "Stop"
and "Accept" as well as "Restart")
To make smbd (and nmbd) start up automatically, click on the
"Automatic" button so that it appears to be "pressed in".
(Clicking on it again makes the button appear to be "pressed out".)
==>Automatic (click to press it "IN")
==>Start (to start smbd and nmbd NOW)
==>Accept (this accepts the changes you just specified, namely,
make smbd start automatically and to start it now.)
==>Quit (for samba configuration, you are done now).
==>Quit
==>Quit (this finally quits linuxconf)
Stopping (or restarting) samba services
- /etc/rc.d/init.d/smb stop (or restart)
- shutdown -r now (reboots your machine - drastic; you should almost never have to reboot your machine)
- kill the processes smbd and nmbd "by hand":
- find the process numbers for smbd and nmbd:
- ps aux | grep smbd
- ps aux | grep nmbd
- look at the 2nd column for the PID (Process ID Number)
- kill the processes (referring to the process_id_number):
- kill -9 pid_num_of_smbd
- kill -9 pid_num_of_nmbd
- /usr/sbin/smbd and /usr/sbin/nmbd to (re-)start "by hand"