Resource Sharing in a Mixed Windows/Linux Environment
Linux-to-Linux
UNIX (and therefore Linux) was designed for file sharing from the
beginning, and so the setup is very straightforward, as shown below.
Windows File Sharing
- Windows and IBM established the NetBIOS protocol (API) for
computer-to-computer networking, with an underlying NetBEUI transport
layer. NetBIOS also was implemented for Novell and more importantly,
TCP/IP.
- NBT (NetBIOS over TCP/IP) was implemented on all Windows
since Win95 as well as on OS/2.
- Windows called this SMB (Server Message Block) service,
although they now seem to prefer the term CIFS (Common Internet
File System) instead. Same thing.
Samba
Samba is an open-source program to implement SMB on a UNIX
or Linux system, causing it to masquerade as just another Windows box.
- SMB has two main services:
- The obvious File and Printer Sharing, and
- Name Resolution completely independent of the Internet's
DNS. (A box in a shared network which is also connected to the
Internet thus has two names, although if you are smart,
you will make both of them the same!)
- Each LAN has at least one WINS (Windows Internet Name
Server), which can be either a Linux or Windows system, used to
resolve SMB names in the same manner as DNS.
- Samba therefore has two possible daemons running:
- smbd, the Samba daemon, which handles both server and
client data services.
- nmbd, the WINS server, if necessary.
Setting Up the JOHN Local Area Network
At the moment, my household consists of the following:
- gateway, 192.168.1.1, the router to the Internet, running FLOPPYFW.
- athlon, 192.168.1.3, my desktop, running SuSE 8.2.
- dell, 192.168.1.7, my laptop, running SuSE 8.2.
- photo, 192.168.1.8, my photo processor, running Windows 98SE.
- Assorted other machines as necessary — my old laptop,
Becky's Win98 machine, the CTPCUG laptop, etc.
- All these are connected to a 10/100 Ethernet switch.
From my point of view, the JOHN LAN (aka Workgroup) will consist of
athlon, dell, and photo, all of which have 100mbit
full-duplex Ethernet. I wish to share file directories (and
eventually printers, CD-ROM burner, scanner, etc.) in both directions
between all three machines.
VERY IMPORTANT NOTICE — I am the only user of these
three machines, they are under my physical control, and they are
isolated from the Internet behind a firewall. As such, there is no
real need to have any machine-to-machine security. (The only person
who could hack into them (i.e., the only other person with a computer
behind the firewall) is Becky, and she would find it much easier to
walk down the hall and use the computer in question directly!) The
discussion below gets much more complicated if we have
to get into security issues. Be aware that what I am about to show
leaves all three machines wide open to each other.
Linux-to-Linux
- The NFS protocol provides the Network File Sharing.
- The NFS Server provides files, and the NFS Client
uses them.
- Both are easily configured in SuSE via YaST Network Services.
- The NFS Server screen allows the user to (a) show the
files/directories to be shared by the current machine, and (b) which
systems are permitted to use them.
- The NFS Client screen sets up the /etc/fstab entry — i.e.,
where the other computer's shared resource will be mounted on the
current machine.
- Once this is done on both the athlon and dell Linux
machines, the resources appear in the respective Linux directory
structures and can be used exactly as if they were local.
- Note that the computers are identified by their IP addresses
and/or DNS names, in accordance with UNIX practice.
Setting up Samba on the Linux Side
- Samba is controlled by the file /etc/samba/smb.conf, which
can be edited manually or through the supplied Samba Web
Administration Tool — SWAT. The entries in smb.conf
control, among other things:
- Global stuff like the name of the LAN, security issues such as
whether "guest" machines will be allowed access, passwords for the
allowed users, etc. Note: if the Windows side is Win98 or higher, be
sure to globally set "Use Encrypted Passwords" or nothing will work right.
- Shares, including the local path, whether access is to be
read-only, etc.
- SWAT provides excellent help documentation for all options.
- When you think you have everything set up, use the testparm
program to validate smb.conf.
- Use YaST to configure inetd (the Internet services
super-daemon) to run smbd and, if desired nmbd. Since
the laptop will not always be present and the Winbox isn't stable,
athlon will be the name server. BTW, set up inetd to
run SWAT, too.
- Use the program smbstatus to see if everything looks good
on the Linux side.
Setting up SMB on the Windows Side
- Go to Control Panel-->Network-->Configuration to be sure TCP/IP is set up.
- At -->WINS Configuration, enable WINS resolution and provide the
IP address of the WINS server. In this case, 192.168.1.3 (athlon).
- At -->Bindings, double check that "Client for Microsoft Networks"
and "File and Printer Sharing" are available.
- At -->Network-->Identification, enter the Windows computer's SMB name
(photo) and workgroup (JOHN).
- At this point, (after rebooting once or twice, of course)you
should be able to go to "Network Neighborhood" and see the directories
being offered by the athlon and dell Linux boxes.
- In Windows, remote directories are identified as a UNC in
the form \\hostname\sharename. For instance, if the
\usr\images directory on the Linux desktop is shared under the name
images, then a file in that directory might be accessed in
Windows as \\athlon\images\myfile.jpg.
- To make life easier, execute the command net use <drive>
<UNC> for each directory shared from the Linux machines. E.g.,
net use I: \\athlon\images will allow Windows 98 to see
athlon's \usr\images directory as the "I:" drive instead, so one
could simply use I:\myfile.jpg.
References
- Using Samba, 2nd Edition, Eckstein and Collier-Brown,
O'Reilly, 2003. Has step-by-step instructions for setting up
everything, with examples from Win98, WinME, and WinXP.
- The Samba documentation installed on Linux with the software. The
easiest way to access them is via SWAT. They are quite extensive and
amazingly readable.
Last modified: Sun Sep 19 03:52:33 2004