Many IT pros and business people use Linux as their resident sendmail platform. They may hate Microsoft, but most...
of them still have to work in a company or with business partners or customers that use Windows systems. So, how can we put this Linux box to some real use, and perhaps get rid of some Windows 2000 servers in the process? Did you say Samba? Yes!
As many of you may know, Samba is a program that allows Windows and Unix or Linux computers to share files. It uses SMB (Server Message Block) from Microsoft to communicate. This layer runs on top of TCP/IP, which allows the Linux server to function as a file and/or print server. It is based on the NetBios service and, as many of you may not know, it has been around for over 10 years now.
Depending upon what variant of Linux you have, you may not have Samba installed on your server. First, you'll have to check this. Samba may be already running on your box, do a ps -ef | grep smbd to check.
Alternatively, you can also search for the existence of Samba. Try a "which," (which Samba), which should tell you where your script lies. On my distribution, it was /usr/sbin/samba. It points to the existence of the config file in /etc (/etc/smb.conf). It can also be in /etc/samba.
If you don't have Samba, you can get it easily through a ton of places on the Internet. Check out the Samba.org site for the nearest downloadable area.
If you have it, let's get started. The config file you'll be working with is smb.conf. There are two sections of note: one is the global section; the other is the section for the specific share (share definitions) that you wish to create. The global section applies to the general parameters.
Every file is different, so you don't need to create it exactly like my example below. Be advised that there is a lot of stuff in the installed config file (most of which is usually already commented out), but for the purposes of this exercise, just look at these settings.
But, here is a piece of my sample for your information. This system was configured using Mandrake Linux 7.1, using kernel 2.2.15-4, Samba 2.0.6.
workgroup = workgroupname
guest account = nobody
path = /home/share
comment = my log files
public = no
writeable = yes
printable = yes
create mask = 765
The basic things you need to concern yourself with are as follows:
- The workgroup should be the area in Windows that is defined as your workgroup.
- You also want to set up an account to log in.
- This example uses a login called nobody, as it is usually setup in your password file. Alternatively, you can also put a valid users area in the sharename section, something like valid users = fred. The create mode specifies your permissions.
It's also important to note that some newer versions of Samba come with LDAP. If you don't want this, then you'll have to force Samba to use the samba password files. Something like this should help you:
Passdb backend = smbpasswd
Smb passwd file =/etc/samba/smbpasswd.
When making any changes in the config file, you must stop and restart Samba to take effect. The Samba script (my distribution has it in /usr/sbin/samba) should tell you how to start and stop Samba on your particular variant. On my distribution, it is "Samba start" and "Samba stop."
There is a lot more fun stuff you can do when all this done. For instance, you can set up some better security.
Back to our example, where it's time to go to your network places (Windows XP) and view workgroup computers. You should see your Samba server right here. Create a mapped drive also in Windows, so you can automatically save files to your new server. In WindowsXP, right click on "my network places" and pick map network drive. From here, select your drive letter and put in your server and share as defined in smb.conf (I.E.,linux1linuxshare) and start using this server as a file server.
You may also want to check out the graphical interface called SWAT, which might help you configure this (assuming you have it installed).
One other parameter you may want to configure before you are finished is the hosts.allow setting. This option restricts connections to machines, which are in your local network. For example, I have it set as
hosts allow = 192.168.201 127.
This restricts the access to one class C network and the loopback interface.
If you have any problems, you can submit questions here, and I'll do my best to answer them!
Kenneth Milberg, a Unix Systems Consultant, has been working with Unix systems over 12 years, during which he has managed, configured and administered various Unix environments. He also answers questions about Unix-Linux migration & issues for SearchEnterpriseLinux.com -- click here to read his answers.