1.15. Setting up Samba as a print server


If you set up Samba as a print server, clients in your network can use Samba to print. Additionally, Windows clients can, if configured, download the driver from the Samba server.

Parts of this section were adopted from the Setting up Samba as a Print Server documentation published in the Samba Wiki. License: CC BY 4.0. Authors and contributors: See the history tab on the Wiki page.

1.15.1. Prerequisites

Samba has been set up in one of the following modes:

1.15.2. Enabling print server support in Samba

By default, print server support is not enabled in Samba. To use Samba as a print server, you must configure Samba accordingly.

注意

Print jobs and printer operations require remote procedure calls (RPCs). By default, Samba starts the rpcd_spoolss service on demand to manage RPCs. During the first RPC call, or when you update the printer list in CUPS, Samba retrieves the printer information from CUPS. This can require approximately 1 second per printer. Therefore, if you have more than 50 printers, tune the rpcd_spoolss settings.

Prerequisites

  • The printers are configured in a CUPS server.

    For details about configuring printers in CUPS, see the documentation provided in the CUPS web console (https://printserver:631/help) on the print server.

Procedure

  1. Edit the /etc/samba/smb.conf file:

    1. Add the [printers] section to enable the printing backend in Samba:

      [printers]
              comment = All Printers
              path = /var/tmp/
              printable = yes
              create mask = 0600
      重要

      The [printers] share name is hard-coded and cannot be changed.

    2. If the CUPS server runs on a different host or port, specify the setting in the [printers] section:

      cups server = printserver.example.com:631
    3. If you have many printers, set the number of idle seconds to a higher value than the numbers of printers connected to CUPS. For example, if you have 100 printers, set in the [global] section:

      rpcd_spoolss:idle_seconds = 200

      If this setting does not scale in your environment, also increase the number of rpcd_spoolss workers in the [global] section:

      rpcd_spoolss:num_workers = 10

      By default, rpcd_spoolss starts 5 workers.

  2. Verify the /etc/samba/smb.conf file:

    # testparm
  3. Open the required ports and reload the firewall configuration using the firewall-cmd utility:

    # firewall-cmd --permanent --add-service=samba
    # firewall-cmd --reload
  4. Restart the smb service:

    # systemctl restart smb

    After restarting the service, Samba automatically shares all printers that are configured in the CUPS back end. If you want to manually share only specific printers, see

Verification

  • Submit a print job. For example, to print a PDF file, enter:

    # smbclient -Uuser //sambaserver.example.com/printer_name -c "print example.pdf"

1.15.3. Manually sharing specific printers

If you configured Samba as a print server, by default, Samba shares all printers that are configured in the CUPS back end. The following procedure explains how to share only specific printers.

Prerequisites

  • Samba is set up as a print server

Procedure

  1. Edit the /etc/samba/smb.conf file:

    1. In the [global] section, disable automatic printer sharing by setting:

      load printers = no
    2. Add a section for each printer you want to share. For example, to share the printer named example in the CUPS back end as Example-Printer in Samba, add the following section:

      [Example-Printer]
              path = /var/tmp/
              printable = yes
              printer name = example

      You do not need individual spool directories for each printer. You can set the same spool directory in the path parameter for the printer as you set in the [printers] section.

  2. Verify the /etc/samba/smb.conf file:

    # testparm
  3. Reload the Samba configuration:

    # smbcontrol all reload-config
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部