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
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 45 of 45.
-
Using print server with USB printer
2005-04-16 18:44:56 OzRob [Reply | View]
There are many small print servers that allow a USB printer to connect to a network, however it seems they only support Windows. Whenever I try to print through it using my Mac, it just sends PostScript (by default the driver is "laserwriter").
Is there some way to configure Mac printing so that it uses my choice of printer driver to send data to the networked printer?
For the record, I'm trying this with a Samsung ML-2250 printer and Linksys PSUS4 print server with 4-port switch.
The printer is supposed to support PCL6, but using Ghostscript's HP LaserJet 6 driver (which is supposed to be PCL6) I just get reams of crap (a la sending PostScript to a non-PS printer). When I connect to the printer via the print server using Windows, the driver says "Samsung ML-2250 Series PCL 6".
I've tried a number of HP drivers, but all with the same results - there is no Ghostscript driver for the ML-2250.
Lastly, I'm doing this because I have 4 networked Macs and don't want to use one to share the printer using USB sharing (which is my current solution). My only other option is to install a USD150 PostScript DIMM in the printer - but I'm not sure that will work either.
-
Using print server with USB printer
2005-09-12 12:03:34 Signore_Rossi [Reply | View]
Just for your information:
The ML-2250 runs fine under Mac OS X 10.4 using the original driver from Samsung for the ML-2150!!! I bought it "accidentially" and tried a lot to make it work untill I found out that it works this way...
Hope that helps!
Gerd
-
root won't authenticate
2005-02-24 12:56:51 IDunno [Reply | View]
I've setup SWAT as detailed, but when connecting to localhost:901 and prompted for a username/password it won't accept it - it'll return back to the same login prompt.
The root user has been enabled and has a password set. This is both with the original swat config file that comes with OS X as well as the one detailed in this article.
Any suggestions? -
root won't authenticate
2005-02-24 13:18:27 Jason Deraleau |
[Reply | View]
Some others have reported issues when accessing SWAT on a Mac without the Dev Tools installed. One thing worth noting is that this article is aimed at Jaguar users. Panther made a lot of this article deprecated. Today, I tried to use SWAT for the first time on Panther and am encountering the same issue as you. I can't seem to access SWAT, regardless of the authentication credentials I provide. One possible solution is to add a line to your
/etc/xinetd.d/swatfile which contains:
server_args = -a
This will make SWAT run in a mode where it will allow anyone to modify the contents of the smb.conf file (at least, according to
swat'smanpage). It's important to note that if you elect to setup SWAT in this manner, you should be extra sure that xinetd is only allowing connections to the SWAT daemon from localhost. In addition, other users who have console access to the Mac will be able to access SWAT locally.
-
Sharing Other Mac Folders to a PC
2004-01-23 06:06:00 martahari [Reply | View]
Here's the scenario -
I have shared mac folders by going into the Get Info of the folder and giving it appropriate access to be shared on the network. Then I tried to use the terminal edit to share this additional folder to my PC. It shows up on my PC (I think, it's got a long name .... SMC...) but when I try to get into the folder from the PC it tells me I don't have appropriate rights - and doesn't give me the ability to enter in a name and password.
I am green with mac so help me here - the folder I want to share is on a different volume - than where my users folders are located. Does that make a difference? I tried to label it \\volumename\foldername but to no avail.
Please help!! -
RE: Sharing Other Mac Folders to a PC
2004-01-23 06:13:12 Jason Deraleau |
[Reply | View]
What version of Windows? -
RE: Sharing Other Mac Folders to a PC
2004-01-23 09:55:59 martahari [Reply | View]
It's Windows XP -
Update - more description:
There are 3 volumes on this mac: OS 10, OS 9, and Projects.
I can successfully share folders on the OS 10 volume. I want to share the Projects volume - with everything in it. Is there a way to use the unix tweaking in this article to point the shares to the Projects volume? I have the projects volume shared on the network with all privleges on but still can't figure out how to make the windows pc see it.
Thanks....
ps- can you describe what a volume is?
-
panther
2003-11-05 01:18:49 anonymous2 [Reply | View]
what would be equivalent of "allow user to log in from windows" in panter. I guess I could allow the user to be administrator, but then I cant change their password.
I guess this is the reason for the account created for users of windows computer not being able to browse any of my shared folders beyond their own home area? -
panther
2004-01-14 05:33:50 Jason Deraleau |
[Reply | View]
With Panther, this preference has been removed. All users can now authenticate from a Windows machine.
-
cannot write to file smb.conf
2003-10-27 09:18:33 anonymous2 [Reply | View]
i restarted my computer and held the control,alt, command + s to start my computer in unix as a superuser,then i entered the command pico /etc/smb.conf to add a share , i typed in my share then did control O and then enter, i message showed up cannot write to file or cannot open file for writing , am i missing something, please help.I also tried the terminal and used sudo.
-
Successfully shared a Brother printer
2003-09-30 09:36:48 anonymous2 [Reply | View]
I was able to share a Brother HL-1440 successfully from my Mac to a Windows ME machine over a local network. The techniques here were helpful but not quite enough. You can read the details on how I did it at:
http://www.interfacethis.com/pub/index.php?itemid=32
-
printer does not appear
2003-08-10 05:57:53 anonymous2 [Reply | View]
hello!
this article helped me a lot in understranding sharing files, which now works very well in my little LAN.
as i added the printers-share to smb.conf i expected my stylus color 880 to appear on the win-machine (winXP) but it didn't - do i have to change anything locally so that it is added as a seperate share?
the lpr-command works from the command line but i can't print a testpage from the cups-admin-site. maybe the cups-user has no rights to do so? - in the jobs-list there is no user entered for the test-page and if i click restart job i get the errormessage: client-error-not-possible
any hints, solutions?
greets&thx ma
-
printer does not appear
2003-08-10 05:56:29 anonymous2 [Reply | View]
hello!
this article helped me a lot in understranding sharing files, which now works very well in my little LAN.
as i added the printers-share to smb.conf i expected my stylus color 880 to appear on the win-machine (winXP) but it didn't - do i have to change anything locally so that it is added as a seperate share?
the lpr-command works from the command line but i can't print a testpage from the cups-admin-site. maybe the cups-user has no rights to do so? - in the jobs-list there is no user entered for the test-page and if i click restart job i get the errormessage: client-error-not-possible
any hints, solutions?
greets&thx ma
-
printer does not appear
2003-08-10 05:56:12 anonymous2 [Reply | View]
hello!
this article helped me a lot in understranding sharing files, which now works very well in my little LAN.
as i added the printers-share to smb.conf i expected my stylus color 880 to appear on the win-machine (winXP) but it didn't - do i have to change anything locally so that it is added as a seperate share?
the lpr-command works from the command line but i can't print a testpage from the cups-admin-site. maybe the cups-user has no rights to do so? - in the jobs-list there is no user entered for the test-page and if i click restart job i get the errormessage: client-error-not-possible
any hints, solutions?
greets&thx ma
-
If smbprint doesn't work...
2003-07-18 22:27:44 anonymous2 [Reply | View]
I struggled for hours trying to to get printsmb to work...
I eventually worked out that the problem was path related. I was able to fix it by adding:
setenv PATH ${PATH}:/usr/local/bin
to the first non-comment line of printsmb. Now it works flawlessly.
Hopefully this will be helpful to others.
--
Matthew.
-
swat chdir failed
2003-05-29 15:38:15 anonymous2 [Reply | View]
I've tried this on at least 3 separate machines and it doesn't seem to work correctly... I always get:
400 Server Error
chdir failed - the server is not configured correctly
In each case I've tried fixing permissions, rechecking my xinetd.d/swat file, etc to no avail..
What DID fix the problem was to install the Apple Developer Tools. As soon as this was done, it worked just fine !! ( But I keep forgetting to do this and just relearned it again today !! )
-
swat chdir failed
2003-05-29 15:40:55 Jason Deraleau |
[Reply | View]
Nice catch! I was pretty baffled on this one, since it worked fom the start on my machine. I wonder what in the DevTools is required by SWAT. Thanks!
-
problem activating SWAT
2003-05-23 06:27:09 anonymous2 [Reply | View]
400 Server Error
chdir failed - the server is not configured correctly
OS x Version 10.2.6
I did everything what was asked in the txt.
put the line
swat 901/tcp #swat
in /etc/services
touch file swat in directory /etc/xinetd.d
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
}
restarted xinetd
sudo killall -HUP xinetd
Is there someone that can help?
Thanks in advance -
problem activating SWAT
2003-05-23 11:08:26 Jason Deraleau |
[Reply | View]
Sounds like a permissions error. Assuming you're not running xinetd as a user other than root, you probably have some modified permissions on your disk. Run the command sudo diskutil repairPermissions / to restore the Apple designated permissions. -
problem activating SWAT
2003-08-20 11:58:21 anonymous2 [Reply | View]
I had the same error. Try a "which swat".
Besides the default OS X install of samba, it turns out that Samba was also installed by Fink on my machine (and /sw/sbin comes before /usr/sbin in my PATH). I edited /etc/xinetd.d/swat, changing the "server=" line from "/usr/sbin/swat" to "/sw/sbin/swat" and then everything was fine.
-
OSX and Samba Printer Sharing to Windows
2003-04-18 16:07:18 barrierobuk [Reply | View]
I'm having issues printing form Windows (any machine) to an OSX shared printer (Stylus 1290). It's set up correctly as far as I can tell. I reckon it's similar to the issue where you can set up Samba correctly to share directories, but need to enable user access via the users panel in system preference. My issue being I need to set up guest access to the printer to make the printer broadly accessible. Not being able to enable system users for access from windows means this seems impossible. Unless anybody knows of a work around, or a fix? So much for some of the instructions I've seen on the web. ie. simply activate windows sharing, and click 'printer sharing'!
If you can offer any help, that'll be great.
Thanks
Barrie
-
Automounting
2003-04-14 23:13:04 anonymous2 [Reply | View]
I was wondering if anyone had any tips going in the opposite direction. I have a share on my windows machine that I would like my OS X laptop to always automatically mount. Any ideas?
-
Logging in to Win2k
2003-04-09 11:22:15 anonymous2 [Reply | View]
The inside on Samba was very informative
There are a couple of tricks that can help me.
How can I join a Mac OSx 10.2.4
to a Win2k Server with user authentication?
Vinjemm@aol.com
-
Windows and Linux printing
2003-04-03 01:43:05 anonymous2 [Reply | View]
well this article got my print sharing to work on os x. thanks... The print sharing didn't start working until I installed GIMP-Print
I was able to get my windows 2000 box to print to the os x printer but only with the Generic text print driver. I'd like to get color prints from the windows box. My printer is a Epson Color Stylus 740 - so I tried installing this driver on the Windows machine - but Windows would no longer recognize the printer after doing this. Does anyone know of a way to get the 740 to print color from the win 2000 box.
Plus I was able to print to the 740 from my linux box - but only from the Konqueror browser. I want to be able to print from Mozilla. I found some info on setting the print command (in the Print setup dialog box) in Mozilla to lpr - P Stylus with Stylus being the name of the printer on my network -- but this didn't work. Does anyone have suggestions on what I might try?
-
chdir failed
2003-03-30 07:39:52 anonymous2 [Reply | View]
After following the directions, I tried to run SWAT, but got the following error:
400 Server Error
chdir failed - the server is not configured correctly
I see this error reported a couple of places on the internet, but no obvious fixes.
By the way, xinetd was not running on my system (10.2,4), so I had to start it. The man page on swat mentions inetd?? -
chdir failed
2003-05-23 11:10:13 Jason Deraleau |
[Reply | View]
Sounds like a permissions error. Assuming you're not running xinetd as a user other than root, you probably have some modified permissions on your disk. Run the command sudo diskutil repairPermissions / to restore the Apple designated permissions. -
it works... :-)
2003-05-21 02:11:12 anonymous2 [Reply | View]
It's so easy...:-)
Download the SambaX package under:
--
http://xamba.sourceforge.net/sambax/index.shtml
--
Follow the insturctions, than your Swat-Service is ready to fly :-)
mfg .:.geber.:.
GERMANs click here:
--
http://forum.macwelt.de/forum/showthread.php?s=&postid=564357#post564357
-
Serious warning
2003-03-28 07:16:02 anonymous2 [Reply | View]
After attempting this, my keychain file got corrupted - have no idea why - but keychain first aid will not fix it, keychain access will not delete it, I cannot access Backup to restore it, I cannot access the keychain folder from another logon to implement the backup... it's a mess. I'm just not unix-y enough to know how to retore/delete from that end... so I guess it's onto another login account... from now on I'll use a guest account to tinker with these things... -
Serious warning
2003-05-23 11:12:01 Jason Deraleau |
[Reply | View]
Samba wouldn't at all affect Keychain. I'd say this is a coincidence, not a cause.
-
Sharing a printer with Win 95
2003-03-27 22:10:40 anonymous2 [Reply | View]
This is now the third article that has explained to me how to get my printer shared to Windows and none of them have ever worked.
I went through every step of your procedure and I still can't see the USB printer on my Mac from a Windows box, that despite the fact I've had file sharing working (both ways) for weeks.
Just wondering where the best place to start debugging this connection might be - and where to go for more help.
Tony
-
Log into OS X from Win 95
2003-03-26 06:53:17 anonymous2 [Reply | View]
This article was really great! I'm trying to log into my OS X machine from a Windows 95 laptop. I keep being asked for a password and I keep putting in the password, but it keeps telling me that it's the wrong pass word. Before you ask, yes I checked caps lock and case. Is there a particular reason that my password isn't working? Any suggestions? -
Log into OS X from Win 95
2003-03-31 15:05:42 anonymous2 [Reply | View]
I spent half a day figuring this one out.
When Windows9x or Me attempt to connect to anything outside, they do not allow the user to specify "username" on the remote system. (Me does not allow the user to specify password either). For example, if you're trying to connect from Windows 9x/Me to Mac and your Windows account is named "default", then your user account on the Mac must be named "default". If your windows account is called "MyName", the Mac account must be called "MyName". Again, for Me (at least), the password must also be the same between the Windows and Mac accounts.
BTW, I don't know much about Windows, but I finally found the solution at annoyances.org, a great site for troubleshooting Windows problems. (With oreilly links) -
Log into OS X from Win 95
2003-09-07 15:12:48 anonymous2 [Reply | View]
Can you please elaborate on what needs to be the same, where to put the info on the mac and where to put the info on the windows ME machine. Sorry if this sounds stupid but i just don't get it. I have been trying for days to connect the two machines and I can see the mac in the network neighborhood but when I click on the icon I get the "enter network password" box. Thanks for your help -
Log into OS X from Win 95
2003-10-16 00:40:43 anonymous2 [Reply | View]
if an user logs into a window9x machine with username 'ABC', then you must create an user named 'ABC' in the accounts preferences of your mac -
Log into OS X from Win 95
2003-10-24 16:57:03 ctrebor [Reply | View]
I have tried everything I can think of but I can't get this to work. Running Win 98se. Mac running 10.2.8. I can see the Mac in the Network Neighbourhood and I can get an @Enter Network Password@ dialogue box for my machine with \IPC$ after it. None of my passwords work. -
Log into OS X from Win 95
2003-10-24 17:12:29 anonymous2 [Reply | View]
RE: Last message. Just got access to my home directory at last from 98se. Didn't even need to type in a password. Simply logged on to Windows with my SHORT username and the usual Password- i.e. somewhat different to my OSX logon where I use my FULL name. I took your hint about checking the username. When I double clicked my share it just worked. And fast too. I hate windows! All the hours spent on nothing. All those adapters and protocols... Now I'm growing to hate OSX too! Anyway, I can put it behind me now- I hope... Note, I'm typing this from Windows accessing the shared net connection through OSX. That at least worked practically first time... I'm planning to write an idiot's guide to how to do this, as there doesn't seem to be such a guide anywhere on the net! You know- first set up the PC etc. with how to configure TCP/IP settings etc.
-
getting at win machines from osx
2003-03-24 15:17:21 anonymous2 [Reply | View]
Please forgive me if this is completely obvious, but after all of these configurations, is it then possible for my Mac OSX machine to access some kind of shared folder on the XP machine across the hall? What does that person need to do to make a shared folder that I can access? Can I use this Samba stuff to print from my colleagues windows printer?
Thanks. -
getting at win machines from osx
2003-03-24 15:38:29 Jason Deraleau |
[Reply | View]
This article covers sharing from the Mac to the Windows machine. To go the other way is beyond the scope of something I can easily explain here. There is another article on the MacDevCenter [http://www.macdevcenter.com/pub/a/mac/2002/11/19/mac_pc.html] by Wei-Meng Lee and Brian Jepson. It should answer your questions for you!








Also, files such as MS Word are normally made read-only when someone has them open, but I seem to be able to trounce them (read-only not active when I open them). It also seems that some kind of caching may have overwritten the file uncommanded (the machine's smb logs show a short access from my laptop that reset the file to an older version when I didn't have the file open.)
Is there something odd with the Mac samba client that I should know about or can be fixed?