When running Samba file sharing services on CentOS (specifically smbd version 3.5.5-68.fc13 in this case), you might encounter persistent error messages in /var/log/messages
related to failed CUPS connections. These errors typically appear as:
Nov 30 18:49:34 big03 smbd[9927]: [2010/11/30 18:49:34.850620, 0] printing/print_cups.c:108(cups_connect)
Nov 30 18:49:34 big03 smbd[9927]: Unable to connect to CUPS server localhost:631 - Connection refused
Samba comes with printer sharing capabilities enabled by default. Even when you only need file sharing functionality, the service continuously attempts to connect to CUPS (Common UNIX Printing System) on port 631. When CUPS isn't installed or running, these connection attempts fail and generate log clutter.
The most effective approach is to modify Samba's configuration to disable printing support entirely. Edit your /etc/samba/smb.conf
file with root privileges:
sudo vi /etc/samba/smb.conf
Add or modify these parameters in the [global]
section:
[global]
load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes
After saving the configuration file, restart Samba services:
sudo service smb restart
sudo service nmb restart
Check your logs again - the CUPS-related error messages should no longer appear. You can verify active Samba configuration with:
testparm
For servers purely dedicated to file sharing, consider this streamlined configuration that completely excludes printing components:
[global]
workgroup = WORKGROUP
server string = File Server
security = user
map to guest = bad user
dns proxy = no
load printers = no
printing = bsd
printcap name = /dev/null
[shared]
path = /path/to/shared/folder
browsable = yes
writable = yes
guest ok = yes
read only = no
Remember that these changes only affect new Samba connections. Existing connections might need to be terminated before the changes take full effect. For production environments, consider testing during maintenance windows.
If you later decide to enable printing support, simply reverse these changes and ensure CUPS is properly installed and running.
When running Samba file sharing services on CentOS for Windows clients, you might encounter these frustrating messages flooding your /var/log/messages
:
Nov 30 18:49:34 big03 smbd[9927]: [2010/11/30 18:49:34.850620, 0] printing/print_cups.c:108(cups_connect)
Nov 30 18:49:34 big03 smbd[9927]: Unable to connect to CUPS server localhost:631 - Connection refused
Samba (smbd) by default includes printer sharing capabilities through CUPS integration. Even when you don't need printer sharing, the daemon still attempts to establish connections, causing these errors when CUPS isn't running.
Edit your Samba configuration file (/etc/samba/smb.conf
) with root privileges:
sudo nano /etc/samba/smb.conf
Find or add these directives in the [global]
section:
[global]
load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes
This configuration does three important things:
- Prevents Samba from loading printer support
- Sets a dummy print system (bsd) that requires no actual backend
- Completely disables print spooler functionality
After making changes, verify your configuration syntax:
testparm
Then restart Samba services:
sudo service smb restart
sudo service nmb restart # if using NetBIOS
For a more permanent solution, you can recompile Samba without printer support:
./configure --disable-cups
make
make install
This approach eliminates all printing-related code from the binary.
Check your logs after implementation:
tail -f /var/log/messages | grep smbd
You should no longer see CUPS connection errors, and your file sharing functionality will remain unaffected.