Help File Library: Samba
Samba has been around for a long time and comes from a
group of hackers in Australia. Their home page is http://www.samba.org.
Samba is ported to many flavors of Unix but is most popular
on Linux.
If you have a Linux box and you want to network it with
one or more Windows workstations, you will definitely want
to run Samba. It allows your Linux box to completely emulate
a Windows NT server and you can set up a personal Windows
NT network at a fraction of the cost.
The first thing to do is to set up your ethernet. You can
get a 100 BaseT mini hub for about 50 bucks. You will need
a 100 BaseT ethernet card for each machine as well. Buy
pre-made CAT V or VI cables at the appropriate length. You
can use 10 BaseT in lieu of 100 BaseT but the savings are
not that great compared to the difference in performance.
Don't mix 10 and 100 BaseT. Some hubs and cards will autodetect
and support both, but unless you know for sure, don't mix
them. Be choosy about the card for your Linux box.
Consult http://www.linuxdoc.org/HOWTO/Ethernet-HOWTO.html
to make sure Linux can support it. Consult http://www.linuxdoc.org/HOWTO/NET3-4-HOWTO.html
for information on setting up your ethernet card in Linux.
Check the network configuration on your windows machine(s)
by right clicking on Network Neighborhood and selecting
properties. You should see the following using a 3Com 3C905B-TX
as an example;
Client for Microsoft Networks 3Com Fast Etherlink XL (3C905B
TX) TCP/IP File and Print Sharing for Microsoft Networks
You may have Dial-Up networking installed as well, which
is fine. However, I recommend using IP masquerading to share
your internet connection from your Linux box. If you have
cable modem or DSL, you will have two ethernet cards in
your Linux machine, one for your internal network and one
for your internet connection. If your Linux box connects
to your internet connection via PPP, then you will only
have an ethernet card for your internal network. Consult
http://www.linuxdoc.org/HOWTO/mini/IP-Masquerade.html
for information on this topic.
Initially, we want to make sure that the workstations can
communicate with the server using TCP/IP. For now, set up
Windows to use the "Windows Logon" for Primary Network Logon.
Under the "Client for Microsoft Networks" properties, make
sure that "Log onto Windows NT Domain" is unchecked. Under
TCP/IP properties set WINS configuration to disabled, and
set the IP address to a private IP. I like to use the range
from 10.0.0.0 to 10.255.255.255. This is one of the ranges
dedicated to people with private IP networks. These IPs
are not routable over the internet. I like to use 10.1.1.1
for my server and assign IP's to the workstations consecutively
from there. You can use 255.255.255.0 for the network mask.
Define the IP and hostnames of your workstations in /etc/hosts
as follows using, for example, hostnames of myserver, myworkstations1,
and myworkstation2;
127.0.0.1 myserver localhost
10.1.1.2 myworkstation1
10.1.1.3 myworkstation2
Now you should be able to ping your server from the workstations
DOS prompt using "ping 10.1.1.1" without the quotes. You
should be able to ping the workstations from the server
by using "ping myworkstation1" and "ping myworkstation2"
from the Linux command prompt.
Now for the Samba setup. Create a directory to share amongst
the workstations for example "/pub"
Create your user accounts. You will want to create a separate
account for each user on your network so that you can setup
private home directories later on down the road. If you
used adduser to create your accounts then, most likely,
your users are already a member of a group called "users"
and will have a group ID (gid) of "users" Check your users
gid with "id ". Edit /etc/passwd if required to
set the users gid. Consult the man page on the password
file with "man passwd".
Do a "chmod 775 /pub" and
"chgrp /pub" where
is the gid assigned to the users.
Samba should be available in your distribution. Start up
your package tool and install it. Everything is configured
from samba/lib/smb.conf Create your smb.conf file by consulting
the Samba documentation for this procedure. You should able
to do a "man smb.conf" after installation. You will need
to set your Linux box up to act as a WINS server and Primary
Domain Controller for NT style logins as well. This is explained
in the man page. A sample working smb.conf appears at the
end of this document.
Samba runs two daemons. "smbd" for the windows file and
print services and "nmbd" for the WINS and master domain
browser functions. Start your nmbd and smbd simply by entering
nmbd and smbd into the command line. Check the samba/var/log.smb
and samba/var/log.nmb files to troubleshoot/verify your
smb.conf Stop your daemons using your favorite process manager.
I use Top and I believe it is still standard on almost all
distros. "cd" to samba/var/log and clear your logs each
time using >log.smb and >log.nmb to make it easier to parse
the output each time you start them. Once you get those
two daemons to start and stop without logging any errors
in log.smb and log.nmb you are almost done.
If you are using Windows machines that are newer then Win95
SR 1, they use encrypted passwords. You will need to edit
the registry to enable plain text passwords as follows:
Select the following in the left pane of regedit;
HKEY_LOCAL_MACHINE -> System -> CurrentControlSet
-> Services -> VxD -> VNETSUP
Right click in the right pane and select new -> DWORD value.
Name it EnablePlainTextPassword. Right click on it and select
modify. Assign it a value of 1.
Set up the Windows workstations to do an NT style domain
login using the domain you defined in smb.conf. Under the
"Client for Microsoft Networks" properties, check "Log onto
Windows NT Domain" and enter the domain you defined in smb.conf
Under TCP/IP properties, enable WINS resolution and add
the IP of your Linux box. Users will log into the network
with the user id and password assigned to them when you
created the account. If everything goes well, you will a
have a fully functional Windows NT based network with all
the bells and whistles. >From the workstation, you should
be able to see the server and workstation(s) in the network
neiborhood view of Windows Explorer. You should be able
to add, edit, and delete files in \\myserver\pub and map
it to a drive.
Add the smbd and nmbd to your startup scripts so that the
system starts them on boot. Your distribution may have set
this up for you already when you installed Samba.
There's lots of other neat stuff you can do with Samba
like setting up private home directories and printer shares
and even logon scripts. Samba has a really trick web based
configuration tool called SWAT. You may want to check that
out as well.
Here is a working smb.conf
[global]
workgroup = WORKGROUP
hosts allow = 10.1.1. 127.
load printers = yes
printcap name = /etc/printcap
max log size = 50
security = user
socket options = TCP_NODELAY
interfaces = 10.1.1.1/24
os level = 33
domain master = yes
preferred master = yes
domain logons = yes
wins support = yes
logon script = logon.bat
[homes]
comment = Home Directories
browseable = no
writable = yes
[netlogon]
comment = Network Logon Service
path = /usr/samba/lib/netlogon
guest ok = yes
writable = no
share modes = no
[pub]
comment = Public Directory
path= /pub
public = yes
writable = yes
printable = no
[printers]
comment = All Printers
path = /usr/spool/samba
browseable = no
public = yes
guest ok = yes
writable = no
printable = yes
Note: (sent in by Tom
S.)
I would suggest to use one the following files to change your Windows
registry:
/usr/doc/samba-2.0.5a/docs/NT4_PlainPassword.reg
/usr/doc/samba-2.0.5a/docs/Win2000_PlainPassword.reg
/usr/doc/samba-2.0.5a/docs/Win95_PlainPassword.reg
/usr/doc/samba-2.0.5a/docs/Win98_PlainPassword.reg
These files are easy to use and are available with the latest version of
SAMBA.
To use them you can simply double click on them in Windows and they
change your registry without a fuss.