Printer Sharing: openSUSE 10 and 11 Samba Print Server for Linux & Windows Clients
Simply put: it's about printing to a Linux computer from either a Linux computer or a Windows computer using Samba's SMB/CIFS Protocol.
In this tutorial you share a printer on a Linux host as a print server for both Windows and Linux clients using Samba networking. An alternative protocol, Internet Printing Protocol (IPP) is covered in a separate Tutorial: Linux IPP Printer Sharing. I think that sharing a printer by IPP is easier than sharing by Samba. The reverse scenario where you share a printer on a Windows host as a print server for Linux clients is covered in a third Tutorial: Windows Printer Sharing. This HowTo assumes CUPS is used for printing. Samba of course is installed and running.
Fixed IP address or DHCP Addressing? Your print server can have either a fixed or a dynamic (DHCP) IP address. Dynamic addresses are the Suse do-nothing default. Fixed addressing is the Administrator's choice for Linux servers because it's easier to administer. Tip: there's a reason why fixed IP addressing is widely recommended for servers. Here's a tutorial on configuring addressing both ways: HowTo Configure a NIC in Suse/openSUSE.
Firewall and Ports: You have your network card in the "external" zone of SuSEfirewall2 (note that if it's in the "internal" zone, you're wide open). SuSEfirewall2 blocks the printing port by default, port 631. You can open Port 631 in Yast --> Firewall --> Allowed Services --> Services to Allow --> Cups. Similarly Samba's ports, 135, 137, 138 and 139 are shut unless you open them in Yast (at danger to your Samba setup) or follow the SuSEfirewall2 Tutorial. Tip: turn the firewall off while you get print sharing going, then cope with the firewall.
Starting CUPS: Make sure CUPS is set to always start on booting: GoTo Yast --> System ---> System Services (Runlevels) --> Expert Mode --> cups = yes + runlevels 2, 3 and 5 --> Finish. Also, when you make changes to the CUPS configuration file you need to restart cups with this root shell command: rccups restart.
Check Communications with the Linux server: I ping the IP address of the server from the client as the first test, that's a must. Then I create a shared folder on the server, just to see whether I can see it from the client. Suppose my server's netbios name is suseserver and IP is 192.168.2.2. The real test is to enter these addresses in the client's network browser: smb://192.168.2.2 and smb://suseserver. I expect to see the shared folder using both addresses if my network is up to scratch. If these don't work then your SMB/CIFS name resolution needs tweaking. You can work only with IP addresses if you have a server with a fixed IP.
Authority to change CUPS: When you attempt to make changes in the CUPS admin GUI (which is at http://localhost:631 -- click to see) you'll need a username/password pair. In 10.0 and 10.1 you add a user by entering this command in a terminal: sudo lppasswd -a username. You supply the root password first up, then a password for the user named "username" when asked. In 10.2 and 10.3 you may use root's username/password pair if you wish. If you need to add root to the CUPS authorised users in 10.2/10.3 (test without first) initiate the dialogue this way: sudo lppasswd -g sys -a root.
Setup the CUPS configuration file on the Server: The cups configuration file is the text file "cupsd.conf", located at /etc/cups/cupsd.conf. You can open a root-owned text file like cupsd.conf with either of these commands in a terminal window:
File cupsd.conf is grouped into segments. Locate the segment for two of these segments as indicated below and edit it until it is in the required modified form displayed below:
1: Advertise printers on local network
2: Allow LAN printing to the Linux server
Notice how the local LAN is allowed as 192.168.2.*. If you want to allow all subnets, then uncomment the line #Allow From @LOCAL.
I have attached copies of the adjusted files cupsd.conf that I used to create working servers on Suse 10.0 & 10.1 and openSUSE 10.2 & 10.3 & 11.0 which you can compare against yours.
Set up the Samba configuration file on the server
Samba's configuration is generally preset by the manufacturer appropriately for each Linux distribution. Check that /etc/smb.conf has been set up for Cups and for printer sharing. The [global] entry should contain these lines if not already present:
The [global] paragraph will contain other statement lines that facilitate network communications. Provided that you can pass the tests I mentioned above in para titled "Check Communications", you have the correct extra lines in [global]. For those who really need to know, I have attached a copy of my file smb.conf for you to peruse. It's for a no-firewall situation and zero other security.
Also, the [printers] section should contain these lines:
You MUST have at least one user in the Samba user database. A username and password pair for a valid user will be coded into the printer URL on Linux clients, although not on windows clients.
At this stage with Cups set up and now Samba set up, you can print from either a Linux client or a Windows client to the print server using Samba to communicate with the Cups engine.
Setting up a Linux client printing to a Linux Samba print server
All you need to do is activate the Cups admin GUI and install a printer (not a physical printer), bearing in mind that you're printing to IP address 192.168.2.2 where the queuename there is laserjet1020 (It's a HP Laserjet 1020). The steps are, screen by screen, as follows:
You should now be printing Linux_to_Linux using Samba
That's all for the Samba/Cups network client on Linux folks. It's really very easy but ONLY if you know how first.
Setting up a Windows client printing to a Linux Samba print server
These settings need to be applied in Windows. Tip: Install the win drivers for the printer first.
You should now be printing Windows_to_Linux using SMB/Samba.
That's all for the Windows network client folks, and that's all for this tutorial
Credits: This tutorial was stimulated by advice given by broch, Jop, winxp_escapee and others on the Suse Linux Support Forum, particularly in these threads: Forum topic=48663, Forum topic=41382 and Forum topic=47213
And from a very learning experience in discussion with oldcpu.
I Hope this Tutorial makes life a bit easier for you.
Swerdna: 08 January 2007; last revised 11 November 08