by Dr. Peter Wayne
OK, this isn't exactly an Xbasic article, but I know there's a lot of you out there who are as curious as I am about Linux and maybe this will help cut a few weeks off of your learning curve.
Why Linux? Microsoft XP Home allows 5 incoming network connections. The next step up, XP Pro, permits 10 incoming connections. There's no technical reason for these limitations – it's simply a way of getting customers to pay more for the next step up in licensing. If your network has grown, as has ours, to exceed the limits of an XP Pro server, then your next choice is either Microsoft Server or an alternative operating system – namely, Linux.
I decided that if I had to learn to administer a new technology I might as well go with an Open Source product for which there exists a lot of on-line and printed help. I decided to buy Red Hat Linux, which is among the easiest to install for novices.
I purchased 2 books on Ebay: “Linux for Dummies” and “Red Hat Linux 8.0 Unleashed”. Each one has a copy of Red Hat Linux on 2 CDs. I went with Red Hat 8.0 because that was what I could find on Ebay—it's last year's release. Now Red Hat is up to 9.0 and I've seen that on Ebay recently as well. Total cost of the books was about $40. I needed both books – I started with Linux for Dummies and as I became more skilled I referred more and more to Red Hat Linux Unleashed.
Next I took an old Win 98 HP Pavilion, with a 300 Mhz Celeron processor and 64 Megs RAM, and decided to experiment with wiping out the Windows operating system (OS) and installing Linux. The machine booted from the CD and installed Linux without a problem, except that Linux did not recognize the old Linksys non-PCI network card I had in the machine. I searched on the Internet and found that the card should be supported under Linux, but I needed to install the “tulip” driver, whatever that was. After a few hours of searching for the driver I realized I was too far from being a Linux geek to ever figure out how to install it, so I took the easy way out and ordered a Netgear PCI card for $14.
I was very excited when the Netgear card arrived, but I was bitterly disappointed when, after I installed it, Linux still refused to recognize the card on startup. Another Internet search, this time for “Netgear FA311 and Linux”, got me the answer—in the BIOS of this old machine, accessed at bootup, there's an option for OS—Windows or Other. I had to switch the OS selection to Other, and then magic! -- Linux recognized the network card on startup.
My odyssey was still at an early stage.
I spent about a week of spare time flipping through Linux for Dummies
and learning how to navigate the Linux file system.
The next
step was to properly configure Samba, the software program that
allows a Linux machine to share files with Windows computers. It took
me another week of trial and error and internet searching before I
configured Samba properly. Like so much of Linux, Samba is so
versatile, with so many options, that the hard part is deciding what
you don't need. I'm going to summarize it here, so you can
save yourself some time!
Most of the configuration of Linux is
done in a single directory, “/etc”, which has a
number of subdirectories and simple text files that Linux programs
refer to, either as the computer boots up or later. You will have to
log in as the system administrator or root to make changes to
these important files. Let me go over some of the configuration
changes needed:
Disable the Linux firewall. Just as with Windows, if your OS is running a firewall, no one can connect to it. In my office the network is not connected to the Internet, so there is no reason to keep a firewall going. At home, the computers are connected through a router with a built-in firewall; once again the computer's firewall is not needed. The simplest way to disable the firewall is at installation, telling Red Hat that you don't want one. If you installed it already, you can try to disable it using Red Hat's lokkit program. If that doesn't work, you can remove the entire firewall configuration by erasing the file, “/etc/sysconfig/iptables”.
Make sure that your file, “/etc/hosts”, is configured properly. When you install Red Hat, you are given an option to name your computer system, and you also have a choice whether to use DHCP to automatically assign an IP number to your computer, or to assign an IP number manually. You have to assign a name to your computer, otherwise your computer will get the name “localhost.localdomain”, which happens to be the same name that Windows XP computers use for themselves – that will cause a conflict when you try to connect. I called my computer “WayneLinux” and invented a domain name of “gidoctors”. Your /etc/hosts file should look like this for computers connected to a router that assigns IP addresses automatically:
127.0.0.1 WayneLinux.gidoctors localhost
If you want to manually assign an IP address, then your /etc/hosts file will read something like this (both lines needed):
127.0.0.1 localhost.localdomain
localhost
WayneLinux.gidoctors WayneLinux
In these cases,
I have called my computer “WayneLinux”, part of the
“gidoctors” domain. In point of fact I am not using a
domain and I could probably have left “.gidoctors” out
of the specification, but I decided it's easy enough to leave a
phony domain name in there.
Some Linux systems also have a
file, /etc/HOSTNAME. If you have it, it should now
read:
WayneLinux.gidoctors
Check the /etc/sysconfig/network file to make sure that your machine name is properly entered there as well:
NETWORKING=yes
HOSTNAME=WayneLinux.gidoctors
Next, edit the file, “/etc/samba/smb.conf” to let the Linux machine function as a file server. You can set up a secure server or an insecure server. In my case, I wanted to set up a shared directory on the Linux server, open to all Windows users. You should be aware, though, that Samba has many options to control how Windows users will be able to access files on the server. But fortunately my requirements were fairly simple. Here is a copy of my /etc/samba/smb.conf file:
[global]
workgroup = WAYNE
server string = HP Linux Server
hosts allow = 192.168.2. 127.
map to guest = bad user
guest account = nobody
security =
user
encrypt passwords = yes
smb passwd file =
/etc/samba/smbpasswd
socket options = TCP_NODELAY SO_RCVBUF=8192
SO_SNDBUF=8192
[wms]
path = /usr/wms
public = yes
guest
ok = yes
writable = yes
printable = no
read only = no
force
create mode = 0777
force directory mode = 0777
force user =
nobody
force group = nobody
What does this
configuration file do? It's actually pretty simple. First, it sets
the computer up as part of the Windows workgroup, “Wayne”.
In My Network the computer is identified to the world as
“WayneLinux” with a comment of “HP Linux Server.”
When users attempt to connect, if their computers supply a valid
user name (entered through the Windows logon) to the Linux machine,
they are allowed to view the “public” space in /usr/wms
– it appears to a Windows user, though, as the “wms”
folder on the WayneLinux machine. If users do not supply a valid
user name, however, they are given the privileges of “nobody”,
which is a Linux account with, generally, no privileges –
except that I have also allowed the nobody account to
access the public area. We also force every user who accesses the
public area to have the privileges of “nobody”, and
every file in the that public area belongs to “nobody”.
I have implemented very minimal security by insisting that the only
computers allowed to connect belong to the local intranet of
“192.168.2.xxx” -- that's the meaning of the “hosts
allow” line.
After you create your smb.conf file, you should test it in a Linux terminal window by typing
cd /etc/samba
testparm
“testparm”
will verify whether your configuration file is syntactically
correct.
Then make sure that the user account “nobody” is
not password-protected. It shouldn't be, but in case it is, type
this as root in a terminal window:
passwd -d
nobody
Then copy the password file for the Linux system
to the Samba directory. When logged in as root in a terminal
window, type
cat /etc/passwd | mdsmbpasswd.sh >
/etc/samba/smbpasswd
The next step is to create the
shared directory on the Linux machine, make its owner “nobody”
and give permissions to everyone to read and write in the directory.
Again, as root, type
mkdir /usr/wms
chown
nobody:nobody /usr/wms
chmod 777 /usr/wms
You are really all set to go.
Type service smb restart at a terminal window to start up the
Samba server. Your Windows computers should now be able to see the
Linux machine's public directory:

Figure
1. Under “View workgroup computers”, the Linux server
appears with the other computers in our home network.
And if you click on the machine, you should be taken directly to the shared folders. You can use Windows' Tools, Map Network Drive, to access the shared folder as a drive letter. You can copy your Alpha Five files to the shared folder and access them just as if they were on a Windows server.

Figure
2. The shared directory on the Linux server appears as drive “H:”
After this experimentation I then purchased a new Pentium 4-class machine to function as the office server and set it up in a few hours. Actually I spent a lot of time with the new setup because the version of Red Hat Linux that I had did not properly support the video card on the new machine. I tried to download updated Linux drivers for the video card, but then I realized that Linux offers the option of turning off the graphical user interface. In a server the graphical interface just chews up excess memory and machine cycles. Our server is now running without a keyboard, mouse, or monitor. If I have to access the server for maintenance, I can do it over the network – but from what I've been told by others who have used Linux, I should be able to leave the server alone for months at a time without rebooting.
11/30/2003
Don't forget, we need your feedback to make this site better!