Inside Samba: Windows Sharing for the Mac
Pages: 1, 2, 3
Configuring Windows for Printing
|
|
Now that you have configured Samba to share your printer, it should appear in the Windows Explorer along with the rest of your shares. To install the printer on the Windows machine, double click it in Explorer. A dialog box stating that the server did not have the drivers for the printer should open. Once you've closed the error, you'll be presented with a list of printer drivers available on your system.
If you want basic text printing, select the Generic/Text Only driver from the Generic manufacturer listing. This driver is excellent for debugging purposes, since most printers will handle plain text easily. If you want Postscript printing, select one of the Apple Color LaserWriter drivers from the Apple manufacturer listing. These drivers have the most neutral implementation of Postscript. Once you've selected the desired driver, click OK. The Windows machine should now be able to print to the shared printer on your Macintosh.
It's worth noting that sometimes Windows will send Postscript formatted files that, for some reason, won't print through your printer. I believe this is caused by differences in the way the operating systems handle printing. I resolved this issue by installing the GIMP Print package and writing a short shell script. I then configured Samba to use my shell script as the print command. Below is the script:
#!/bin/sh
#
# /usr/local/bin/printsmb
#
# Print script for Postscript files.
#
/usr/local/bin/ps2pdf13 /tmp/$2
rm /tmp/$2
/usr/bin/lpr -P$1 -r /tmp/$2.pdf
This script makes use of the GIMP Print package's ps2pdf
tool, which will convert the Postscript file from the Windows machine
into a PDF file. The script then removes the temporary Postscript file
and sends the resulting PDF file to the printer using lpr. I placed
the script in /usr/local/bin and gave it 0755 permissions
with chmod. To use this script with Samba, make the following
change to your [printers] section:
[printers]
. . .
print command = /usr/local/bin/printsmb %p %s
Now Samba is configured to call the script and pass the desired printer and the temporary file's path as parameters. The script converts the file and prints it. Postscript printing should give you the same capabilities as printing right from your Mac. With Samba sharing your printer, you can easily let Windows clients print through your system. You can even manage their print jobs through the Print Center or the CUPS control center. Samba also allows you to configure a printer driver share so that your Windows machines will automatically download and install the appropriate software to print to your shared printer, bypassing the driver selection dialog box. Such configuration is a bit beyond the scope of this article, but I recommend taking a look through Using Samba, published by O'Reilly and Associates.
The Samba Web Administration Tool
Now that you're familiar with the common configuration options used to create disk and printer shares, I'm going to introduce you to a faster and easier way to work with your Samba configuration file. The Samba distribution includes a web-based tool that allows you to manipulate your Samba settings. Mac OS X includes this tool as well, but it first needs to be enabled.
Enabling SWAT
To enable the Samba Web Administration Tool, you must configure one of the Internet superdaemons that is included with Mac OS X. Mac OS X includes both inetd and xinetd. However, Mac OS X itself only seems to use xinetd. This is the superdaemon that responds for the FTP Sharing features.
Configuring xinetd to launch swat requires just a few
steps. You first need to check that your /etc/services
file contains a port entry for swat. To do this, enter the following
command in the Terminal: cat /etc/services | grep swat. This
command should return one result, which will list the swat service as
running on port 901/tcp. If you do not get a result for this, add such
an entry to your /etc/services file by editing it with
pico running under sudo or as root. Add an entry that lists the
information above and then save your changes.
Now that your machine knows about the daemon's TCP information,
create a file in /etc/xinetd.d with the name swat and put
the following in it:
service swat
{
disable = no
only_from = 127.0.0.1
socket_type = stream
wait = no
user = root
server = /usr/sbin/swat
server_args = -s /etc/smb.conf
groups = yes
flags = REUSE
}
You will need to be the superuser or use the sudo command
to create this file in the proper directory. For more information on
customizing xinetd, take a look at the man page for
xinetd.conf. The only setting you might want to change is
the "only_from" entry. The example entry allows access only from the
computer itself. You can enter an IP address or network address here
to open up access a bit more. Once you have saved your entry, reboot
the machine (or HUP the xinetd daemon if you are more Unix
savvy).
Using SWAT
|
|
Once you have xinetd configured to share swat, open up your web
browser and enter the address http://127.0.0.1:901/. If
you are prompted to enter a username and password, enter those of your
root user (please note that the root user is disabled by default on
Mac OS X. To enable it, enter the command sudo passwd root in
the Terminal.). You will see the SWAT entry page as shown in Figure
6. Notice along the top there are several different sections of the
tool to use. The Home section has Samba related documentation. On the
Globals section, you will find many directives for the [global]
section of the smb.conf file. SWAT edits the file for you, allowing
you to easily fill in desired fields and then committing changes.
Most of the sections are self-explanatory. At the top you will find a button to Commit Changes and some will have an Advanced button that will show you the more advanced Samba directives. The Status section has buttons that allow you to start, restart, and stop the smbd and nmbd daemons. Remember that you need to restart the daemons after any changes are made to the smb.conf file, whether by SWAT or hand editing. Below the daemon control buttons, you will see a listing of active network connections and individual buttons to force them closed.
The last two sections of SWAT are less often used with Mac OS X. The first is the View section. This section will display your smb.conf file so you can see how SWAT handles the file and makes changes. The last section is the Password section, which allows you to create the encrypted usernames and passwords required by most recent versions of Windows. You shouldn't need to use this tool at all, when you enable a user's Windows access in the System Preferences it generates this information for you.
SWAT is very useful for controlling your Samba daemons and working with their configuration. By making changes to the xinetd configuration file, you can access SWAT remotely using any browser. The various sections of SWAT make it much easier to keep your smb.conf file in order and learn a bit more about its syntax. Once you become more comfortable with the sections of smb.conf, you might choose to edit your configuration by hand, but for those of us in a bit of a rush SWAT is always a great way to go.
Final Thoughts
Now that you're familiar with the configuration of Samba, you should be able to create more advanced shares than the Apple provided GUI tools allow you. Using the SWAT interface will help you keep your configuration error free and easily allow you to restart Samba to see your changes. Overall, Apple has been smart enough to include the best Unix implementation of Windows sharing around and provided all of the necessary tools to get it up and running in a variety of configurations. Samba is invaluable in helping your Mac integrate with a Windows network. Your Windows associates won't even be able to tell the difference.
Jason Deraleau works as a systems administrator by day, IT consultant and technical writer by night, and is the coauthor of the upcoming Running Mac OS X Tiger.
Return to the Mac DevCenter
-
SMB permissions
2008-01-06 09:01:03 jhood@akoostix.com [View]
-
Using print server with USB printer
2005-04-16 18:44:56 OzRob [View]
-
Using print server with USB printer
2005-09-12 12:03:34 Signore_Rossi [View]
-
root won't authenticate
2005-02-24 12:56:51 IDunno [View]
-
root won't authenticate
2005-02-24 13:18:27 Jason Deraleau |
[View]
- Trackback from http://thequality.com/admin/weblog/archives/001643.html
Hog share added to axel
2004-07-05 01:41:27 [View]
-
Sharing Other Mac Folders to a PC
2004-01-23 06:06:00 martahari [View]
-
RE: Sharing Other Mac Folders to a PC
2004-01-23 06:13:12 Jason Deraleau |
[View]
-
RE: Sharing Other Mac Folders to a PC
2004-01-23 09:55:59 martahari [View]
-
panther
2003-11-05 01:18:49 anonymous2 [View]
-
panther
2004-01-14 05:33:50 Jason Deraleau |
[View]
-
panther
2004-01-13 20:56:25 anonymous2 [View]
-
panther
2003-12-13 13:00:41 anonymous2 [View]
-
cannot write to file smb.conf
2003-10-27 09:18:33 anonymous2 [View]
-
Successfully shared a Brother printer
2003-09-30 09:36:48 anonymous2 [View]
-
printer does not appear
2003-08-10 05:57:53 anonymous2 [View]
-
printer does not appear
2003-08-10 05:56:29 anonymous2 [View]
-
printer does not appear
2003-08-10 05:56:12 anonymous2 [View]
-
If smbprint doesn't work...
2003-07-18 22:27:44 anonymous2 [View]
-
swat chdir failed
2003-05-29 15:38:15 anonymous2 [View]
-
swat chdir failed
2003-05-29 15:40:55 Jason Deraleau |
[View]
-
problem activating SWAT
2003-05-23 06:27:09 anonymous2 [View]
-
problem activating SWAT
2003-05-23 11:08:26 Jason Deraleau |
[View]
-
problem activating SWAT
2003-08-20 11:58:21 anonymous2 [View]
-
OSX and Samba Printer Sharing to Windows
2003-04-18 16:07:18 barrierobuk [View]
-
OSX and Samba Printer Sharing to Windows Â
2003-07-25 07:25:12 anonymous2 [View]
-
Automounting
2003-04-14 23:13:04 anonymous2 [View]
-
Logging in to Win2k
2003-04-09 11:22:15 anonymous2 [View]
-
Windows and Linux printing
2003-04-03 01:43:05 anonymous2 [View]
-
chdir failed
2003-03-30 07:39:52 anonymous2 [View]
-
chdir failed
2003-05-23 11:10:13 Jason Deraleau |
[View]
-
it works... :-)
2003-05-21 02:11:12 anonymous2 [View]
-
Serious warning
2003-03-28 07:16:02 anonymous2 [View]
-
Serious warning
2003-05-23 11:12:01 Jason Deraleau |
[View]
-
Sharing a printer with Win 95
2003-03-27 22:10:40 anonymous2 [View]
-
Log into OS X from Win 95
2003-03-26 06:53:17 anonymous2 [View]
-
Log into OS X from Win 95
2003-03-31 15:05:42 anonymous2 [View]
-
getting at win machines from osx
2003-03-24 15:17:21 anonymous2 [View]
-
getting at win machines from osx
2003-03-24 15:38:29 Jason Deraleau |
[View]
-
windows printer sharing
2003-03-23 14:52:37 anonymous2 [View]



