Win95 Connectivity Using Samba/SMB
Last Updated on December 9th 1998


An article submitted by my
friend Arto Repola in Finland



Foreword

MH NOTE: This page was contributed by my friend Arto Repola, over in Finland. He recently went through setting up Linux as a drive and printer server for some Windoze clients. He had asked if he could put his trials and tribulations on my site, so without further ado, I bring you his step-by-step procedure to setting it up -- enjoy! (all that follows is his text)

Introduction

Q: What is Samba after all? Is there anything in common between Samba and the Brazilian annual festival/carnival where people spend their money to buy expensive clothes?

A: NO! (at least as far as i know) Samba is a package which allows you to access your Linux/SGI/Solaris box from a client which is running WfW v3.x, Win95 or WinNT as it would a normal network drive. Imagine... If you have couple of machines in your room and one is an Ultra-New-PII- With-All-Kind-Of-Gizmos and the other is an old 486 for example, you can setup your 486 to act as a server so you can browse it from your other machine.

Q: So what do i need?

A: A couple of working computers, two network cards, 10-Base-2 cabling, lot's of patience and coffee (black, sugar, no milk), a few packs of cigarettes, nerves of steel... You name it!

Q: I've heard that there are some "free" ip-addresses that i can use to build my private LAN. What are you talking about?

A: According to the NET-3-HOWTO, which should come with your Linux distribution, there are quite a lot of free ip-addresses which you can use freely to build up your private LAN without disturbing other people around the 'Net. Here are those free IP's:

Network
Class     Netmask         Network Addresses

A         255.0.0.0       10.0.0.0    - 10.255.255.255
B         255.255.0.0     172.16.0.0  - 172.31.255.255
C         255.255.255.0   192.168.0.0 - 192.168.255.255

Q: I'm pretty confused. Let's say that I have Win95 installed at home and another machine is an old 486 which I don't use anymore. Could you give me some example how to do this? Is the 486 capable enough to do network stuff 'cause this machine only has 8mb of memory and a 540MB HD?

A: SURE! For a comparison, I created a small LAN (2 machines) at my friend's company. The server is 486/33mhz/8mb/3com509 NIC and the client was a 486/100mhz/16MB/3com509 and they worked smoothly! For this following example I used two imaginary hostnames and domain name. Let's say that your serverīs name is Kirk :) and your client's name is Spock and your domain is starfleet.com. I "reserve" IP 192.168.1.1 for Kirk and 192.168.1.2 for Spock.

1. First I assume that you are using Redhat 5.0. You can insert these lines manually to /etc/hosts file or by using netcfg under X. The choice is yours.

# /etc/hosts

192.168.1.1	kirk.starfleet.com	kirk
192.168.1.2	spock.starfleet.com	spock

Now we are set! Just make sure that you have compiled support for your NIC (or have the modules in place). Next we run these following commands at the prompt. NOTE! You can add these lines to /etc/rc.d/rc.sysinit so every time when you boot your machine (probably never if you donīt have any hardware problems, power outages or kernel upgrades).

/sbin/ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up
/sbin/route add -net 192.168.1.0 eth0

2. Double check that you have the smbd and nmbd daemons running in the background by using these commands:

ps -aux | grep nmbd
ps -aux | grep smbd

3. Next we edit our /etc/smb.conf file to make sure that you can browse this machine from Win95. Make sure that you add at least these lines to your smb.conf file. Before I found these options I got a big headache by trying to find out what could be wrong:

[global]
guest account = guest
null passwords = yes   ; VERY important! This is a must!

4. Create an account called guest and without a password for a start. If you are conserned about your LAN security then it can increased by setting a password for user "guest" which increases your security a little bit. If you don't use a password with user guest, than at least use "/bin/false" as the shell for that user, to prevent them from actually logging into your Linux machine (although they can still use Samba fully).

THAT'S IT!

Let's Move to the Win95 Setup

1. Click on the Network icon in the Control Panel
2. Add a driver for your NIC if haven't done it by now!
3. Click the Add button and choose the TCP/IP protocol
4. Click the Add button and choose Client for Microsoft Networks

Now we are close to the end -- excited that it works? (drum roll)

In the Network window choose the Identification tab. Type "WORKGROUP" in the workgroup section or put whatever worgroup name you would like in there -- just make sure that if your workgroup name is different than "WORKGROUP" that you put it in /etc/smb.conf file also, and restart Samba by using these two commands:

/etc/rc.d/init.d/smb stop
/etc/rc.d/init.d/smb start

Make sure that you have entered the computer name "SPOCK" without quotes in the Idenfication section.

Next, in the Network window, select TCP/IP and select the properties tab. Put our imaginary ip-address or your own selected address in the IP section (192.168.1.2) and use a netmask of 255.255.255.0

Next go to the WINS tab and enter Kirk's ip-address as your WINS server (192.168.1.1). Click Ok.

You don't have to enter anything on the Gateway tab unless you are playing with IP masquerading, for example.

Choose the Bindings tab and make sure that Client for Microsoft Networks is enabled! You don't want to know for how long I tried to find out why my friend's network suddenly ceased to co-operate... This was really frustrating!

Now we're done! When you click on Ok, Win95 will want to reboot your machine (what else is new).

Now let's finally test this!

When Win95 boots, you will get a prompt which looks like this:

Username: enter "guest" here without quotes
Password: enter password here unless you have none

After this, click on Network Neigborhood. After a few seconds you should see your machine "Kirk" waiting for you. If have configured your network settings correctly you should see the available shares!

It's done! Enjoy!

Troubleshooting

If you don't see kirk in the Network Neigborhood section then here are few steps to make sure that at least your NIC's are okay and there are packets moving on your cables.

  1. Try to ping your machines. Under linux type "ping 192.168.1.2" Now you should receive echo replies from Win95. You can stop this operation by pressing CTRL+C. You can also try names like this: ping spock or ping spock.starfleet.com. If you don't receive any echo replies, double check your network settings. One good way is to check NIC settings is by using the command ifconfig which shows the NIC's settings and route which shows route tables to the other machines. If route hangs for a moment try route -n. In this case it won't try to "resolve" your hostname, thus speeding up "finding" the computer on the network.

  2. Try to telnet to the linux machine from the Win95 machine. Click on Start in lower left corner, select Run and type telnet in the box which will pop up. Aftet that, select connect and first use an ip-address rather than a name (192.168.1.1). If you get a prompt soon there's surely some kind of traffic between your machines. If you don't get any prompt and it waits forever in that state with a flashing cursor, double check that you don't have any extra settings in /etc/hosts.allow and /etc/hosts.deny files which prevents other machines to use linux services.

  3. Download a program called IPTraffic from http://freshmeat.net. It's a menu-based program which can be used to monitor your Ethernet traffic for example or your ppp0 device for ppp connections. It's very useful, really easy to use and has lots of options, so you can easily fine-tune what you want to monitor and what not to. Just place iptraf in the freshmeat search field and it will find and show it's appindex to you.

  4. If your printing still isn't working, first check to make sure that you have the /etc/printcap file up-to-date before you start to blame me. :) I have an HP DeskJet 660C at home and I configured my printer under X using the Red Hat control-panel (also you can use printtool). Here is an example printcap file:

    # /etc/printcap
    #
    # Please don't edit this file directly unless you know
    # what you are doing!  Be warned that the control-panel
    # printtool requires a very strict format!  Look at the
    # printcap(5) man page for more info.
    #
    # This file can be edited with the printtool in the
    # control-panel.
    
    ##PRINTTOOL3## LOCAL cdj550 300x300 a4 {} DeskJet550 1 {}
    lp:\
            :sd=/var/spool/lpd/lp:\
            :mx#0:\
            :sh:\
            :lp=/dev/lp1:\
            :if=/var/spool/lpd/lp/filter:
    

    ...Then double-check also that you have at least the following lines in /etc/smb.conf (these should be the default settings and expect that "public=yes" one).

    [printers]
       comment = All Printers
       path = /var/spool/samba
       browseable = no
       printable = yes
    ; Set public = yes to allow user 'guest' to print
       public = yes
       writable = no
       create mode = 0700
    

    Make sure you don't have one of those WIN95-ONLY (Plug & Play) printers! With these printers you get a lot of headaches. If you have an older printer then it's almost guaranteed that it will work fine with Samba. There is a "rule" - the older printer, the better!

  5. You know you have configured your settings correctly but Win95 or WinNT starts to complain that your password is incorrect? This can happen if you have patched your Windows to a later one. I have an older Win95 at home and therefore i don't have to change anything. Check the documents under /usr/doc/samba-xxxx, especially files concerning Win95's passwords. Later versions of Win95 doesn't allow plain-text passwords to go the wire. You have to use regedit to modify your Win95/WinNT registry to allow passwords to go 'plain-text' over the wire.

  6. Would you like that your clients could see the available shares with user "guest" priviledges no matter what login name they use? I really needed to find out how this can be accomplished and once again "man smb.conf" saved me. I can't understand how I've never noticed this option but after this, all will be different. This is very useful and it might save you in many situations.Take a look at an option called "username map". All i had to do after I read this option was to put a line like this into a file called "names" (you can use any filename you want)

    guest = *  
    

    After i saved this file and placed this following line to /etc/smb.conf and restarted my Samba i could enter whatever login name and see the available shares without getting annoying message "incorrect password".

    [global]
    username map=/root/names
    
  7. You are ABSOLUTELY sure that your routes are set and you have configured your /etc/smb.conf correctly but you still don't see the available shares? I tried all DIAGNOSIS.txt options and everything seemed to work except when i came to this part:

    nmblookup -B BIGSERVER __SAMBA__
    

    So I replaced BIGSERVER with my netbios name B5 and look what I got:

    [root@localhost /etc]# nmblookup -B B5 __SAMBA__
    Sending queries to 192.168.1.1
    127.0.0.1 __SAMBA__<00>
    

    Strange... I waished that Samba would reply with address 192.168.1.1 and NOT 127.0.0.1. So once again I typed "man smb.conf" and I found a really nice option called "interfaces." After I had entered this following line into /etc/smb.conf's [global] section it worked just fine!:

    [global]
    interfaces = 192.168.1.1/24
    
    /etc/rc.d/init.d/smb stop
    /etc/rc.d/init.d/smb start
    
    [root@localhost /etc]# nmblookup -B B5 __SAMBA__
    Sending queries to 192.168.1.1
    192.168.1.1 __SAMBA__
    

    Voila! It started to work instantly!

MH NOTE: Another thing you might check is the settings in /etc/smb.conf and look for the line that says "security=" and set it to "share" so that it functions just like Windows default behavior. You can also set this to use your Linux machine's user/pass combinations, or lastly, have an NT server do the authentication.

Closing

This document was created at my home in Raahe, Finland on April 22, 1998. Local time is 9pm right now. Good night to everyone and God bless you all!

This document is dedicated to the ALL_MIGHTY_LINUX_GURU LINUS! You've done something that will never be forgotten!


All images are (C) 1994-2005 by Michael Holve