Here's my quick-n-dirty method for turning a pile of Intel hardware into a
Samba server.
Disclaimer: this guide does not cover security at all. This quickie guide
was written to get Samba up and runing quickly in a small, simple, trusted
environment. If you're concerned about security, buy a book or RTFM.
- Install RedHat Linux 7.x
(I've added some notes from my recent Fedora Core 2 installation)
- Choose Custom and make sure you include SMB server
- SWAT (the Samba Web Administration Tool) includes its own webserver so
you don't have to specify 'httpd' (webserver) if you want to use that
tool.
- Log in as root, type setup, and choose System
Services.
- Enable smb. (This will cause smbd to start at boot.)
- Edit the file /etc/samba/smb.conf and change the
workgroup name to match your workgroup's name.
- Issue testparm to make verify the validity of your
smb.conf file.
- Now, either a) reboot or b) issue service smb start.
If you change smb.conf further, restart the service with
service smb restart. (The four main options to use with
'service' are start, stop, restart, and status.
You can also say reload and condrestart but I don't know what they do.)
- Now, just add users with the 'smbadduser' command. (OR with
'smbpasswd'; see below.) The syntax is
smbadduser UNIX username:Windows username so assuming
you've got a pretty small shop, it shouldn't be too hard to make sure that
each user has a Windows login name that matches an account on your Linux
server. For me, for example, it's just a matter of saying
smbadduser brian:brian.
Some text will fly by and you will
be prompted to enter a password twice.
There are, of course, ways to
automate this, or take advantage of an already existing list, but for now,
just add each user by hand, first with Linux's
useradd
command, then with
smbadduser.
On Fedora Core 2 with Samba 3: Create the users with Linux's
useradd command, then say
smbpasswd -a username for each user. Just one step but you need
the -a flag on each, like
smbpasswd -a larry
smbpasswd -a curly
smbpasswd -a moe
- Now you can connect to the server by mapping a network drive to
\\ip.address\username. (In my case, on a system I just built, it was
\\192.168.0.5\brian.) This will mount your home directory
(/home/username) as a drive in Windows.
- There is much more that can be done. The most common thing is to
assign a NETBIOS name to the server. Also, you can create common shared
areas, share printers, have users added automatically, have their
passwords synced with their local UNIX passwords, etc. SAMBA can even be a
primary domain controller. However, if you just want to get a new box with
a big shared drive up and running, this is all that needs to be done.
-
You might have to mess with the "encrypt passwords =
yes" line. I ran into trouble on my last go-round. Not sure if
the defaults in smb.conf change from one version to the next, or if I was
using old versions of Windows in the past, or what. But, if it is
commented out when it should be uncommented or yes when it should be no
you won't be able to connect to any shares from Windows.
- (what follows
is under construction)
- Everyone likes PDFs, right? Here's how to make a virtual network
printer that you can print to from Windows that will make a PDF for you.
- Create a new directory to store the PDFs, like /home/pdf
- Share this directory out with these lines in your smb.conf:
[pdf]
comment = PDFs
path = /home/pdf
write list = @users
force group = @users
create mask = 0777
directory mask = 0777
guest ok = yes
- Create the virtual network printer/PDF-maker:
[ps2pdf]
comment = PostScript to PDF Print Engine
print ok = yes
guest ok = yes
path = /home/pdf
print command = /usr/bin/ps2pdf %s; rm %s
create mask = 0777
force create mode = 0777
- Once again, issue testparm as root and make sure it's
OK. Then, issue service smb restart to activate the new
shares.
- Map a new network drive to \\your.ip.here\pdf
- Set up the new virtual printer in Windows. Start with Start Menu
—>Settings—>Printers, add new printer, Network Printer,
\\your.ip.here\ps2pdf, next. It will complain that no driver is available
and ask if you want to choose one. Answer 'yes', then click 'HP' in
the left column and pick 'HP Color LaserJet 5/5M PS' in the right column.
- It should now be happy. Set it as your default printer if you want and
tell it to
print a test page. A strangely-named .pdf file should quickly show up in
the drive you just mapped to 'pdf.' Pretty neat, eh? It's a bit limited.
Onscreen, non-standard fonts (anything besides Courier, Helvetica, Times,
etc.) will be bitmapped, as will vector shapes. However, everything should
print OK, since the bitmaps it produces are high-res. On the other hand,
it's a free PDF, so quit complaining. :-)