How to setup Samba printing in CentOS 7 - Tutorial

Updated: September 24, 2014

After reading my Nvidia howto and the perfect desktop guide for CentOS, you sure crave for more. And the problem you are facing is as follows: You want to print to Samba printers, located on Windows machines. Only the Browse button is grayed out. You want to resolve this issue, but you are not quite sure how.

Let me show you the ultimate guide to fixing CentOS 7 printing, and possibly all and any Samba related printing in Linux. This very closely relates to the issue we saw in the fourth part on Windows to Linux migration and an outstanding bug that requires the use of a different printing utility to get things done. Follow me, and read carefully.

Situation report

So you want to print, this shows up:

No Samba printing

How do you resolve this problem? Well, you have read my Ubuntu family printing guide, which recommends using the system-config-printer utility. No worries, install it and try to your Samba printer going.

yum install system-config-printer

If this does not work, try the suggestions I wrote in the Scientific Linux pimping guide, and maybe that will solve your problem. Most likely not, but worth a try.

yum install cups system-config-printer gutenprint gutenprint-cups hplip hpijs gnome-vfs2-smb foomatic redhat-lsb-printing libgnomeprintui22 gnome-python2-gnomeprint


You will need to install a Python module called smbc - pysmbc. The problem is, it is not available in the CentOS repositories, so you will have to manually download the package, compile it and fix some extra dependencies there, and then install it. After that, Samba printing through system-config-printer will work fine. This is also true for openSUSE, which featured as our scapegoat in the aforementioned fourth piece on migration from Windows to Linux, where we touched on drivers and devices.

First, head over to and download the right package. Extract the archive, and then in a console window, cd into the directory and check the README file. It says, run make to compile the code. If you try this, you will see the following two errors:

# make
Package smbclient was not found in the pkg-config search path.
Perhaps you should add the directory containing `smbclient.pc'
to the PKG_CONFIG_PATH environment variable
No package 'smbclient' found
python build
Package smbclient was not found in the pkg-config search path.
Perhaps you should add the directory containing `smbclient.pc'
to the PKG_CONFIG_PATH environment variable
No package 'smbclient' found
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/smbc
copying smbc/ -> build/lib.linux-x86_64-2.7/smbc
copying smbc/ -> build/lib.linux-x86_64-2.7/smbc
running build_ext
building '_smbc' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/smbc
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c smbc/smbcmodule.c -o build/temp.linux-x86_64-2.7/smbc/smbcmodule.o
smbc/smbcmodule.c:29:20: fatal error: Python.h: No such file or directory

And this one too:

In file included from smbc/smbcmodule.c:30:0:
smbc/smbcmodule.h:27:26: fatal error: libsmbclient.h: No such file or directory

This means you're missing the header files for the task, which can be replenished by installing the following packages:

yum install python-devel libsmbclient-devel

After that, the compilation will work. Then, you will need to install the Python module, which is done by running, in this same directory where you just compiled:

python install

Launch system-config-printer and enjoy your Samba printing!

Printing works


Work done. Not too easy but doable. And now, this will be the ultimate printing guide for all Samba related problems, from now till eternity, and for all distros, too. You can use this in the exact same manner to fix issues in Ubuntu, openSUSE and all the rest.

'Tis a rich tutorial, too. It teaches how to work with the package manager from the command line, install development packages, work around errors, compile code, and install Python modules. All of them ugly things on their own, but together, it's an orchestra of beauty and accomplishments. Let be no problem what Dedoimedo solveth not. Enjoy.


You may also like: