Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:

How to share a local printer on Linux with Windows using Samba

by Thomas Chung on Jan 02, 2005

Recently, I've purchased a new Ethernet Broadband Router with a built-in four-port switch plus a print server from D-Link. According to its manual, it says I could share my local printer by installing a print server software but it says it 'works with Windows Operating System Only.' So I wonder, is there any way I could share my local printer (Epson Stylus Photo 820) attached to my Linux Box with Windows using Samba instead? The answer is Yes!

Samba is an Open Source/Free Software suite that provides seamless file and print services to SMB/CIFS clients. Samba is freely available under the GNU General Public License. Here is how you can install and configure samba so you can share a local printer on Linux with Windows:

1. Install samba - Use yum to install samba for your Fedora release.

$ sudo yum install samba

2. Configure samba - Edit following section in your smb.conf file. (Here is my complete smb.conf file.)

$ sudo vi /etc/samba/smb.conf

   workgroup = WORKGROUP
   security = share

# Share Printer (2005-01-02 by Thomas Chung)
   printing = cups
   public = yes
   printer name = epson
   use client driver = yes

$ sudo /sbin/chkconfig smb on
$ sudo /sbin/service smb restart

3. Configure iptables - Add following rules to your iptables to accept NETBIOS session service from Windows.

$ sudo vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 139 -j ACCEPT

$ sudo /sbin/service iptables restart

4. Add printer from Windows. (Following screenshots were taken from Windows 2000)

1) Choose Start > Settings > Printers

2) Choose Network printer

3) Type printer name as following. Make sure to substitute with your Linux IP address and Samba printer name.

4) You will see following message since there is no Windows printer driver on Linux. Click OK.

5) Select your model of your printer from following. You might need to install a printer driver from a CD came with the printer.

6) You've added printer driver successfully.

7) Now, print a test page from Windows to the printer which is attached to Linux box.