第 1 章 Using Samba as a server


Samba implements the Server Message Block (SMB) protocol in Red Hat Enterprise Linux. The SMB protocol is used to access resources on a server, such as file shares and shared printers. Additionally, Samba implements the Distributed Computing Environment Remote Procedure Call (DCE RPC) protocol used by Microsoft Windows.

For more information refer to the:

  • smb.conf(5) man page on your system
  • /usr/share/docs/samba-version/ directory that contains general documentation, example scripts, and LDAP schema files, provided by the Samba project

You can run Samba as:

  • An Active Directory (AD) or NT4 domain member
  • A standalone server
  • An NT4 Primary Domain Controller (PDC) or Backup Domain Controller (BDC)

    注意

    Red Hat supports the PDC and BDC modes only in existing installations with Windows versions which support NT4 domains. Red Hat recommends not setting up a new Samba NT4 domain, because Microsoft operating systems later than Windows 7 and Windows Server 2008 R2 do not support NT4 domains.

    Red Hat does not support running Samba as an AD domain controller (DC).

Independently of the installation mode, you can optionally share directories and printers. This enables Samba to act as a file and print server.

1.1. Understanding the different Samba services and modes

The samba package provides multiple services. Depending on your environment and the scenario you want to configure, you require one or more of these services and configure Samba in different modes.

1.1.1. The Samba services

Samba services in Linux include smbd, nmbd, winbindd, and samba-bgqd. Understand their roles in file and printer sharing, name resolution, domain integration, and printer management.

Samba provides the following services:

smbd

This service provides file sharing and printing services using the SMB protocol. Additionally, the service is responsible for resource locking and for authenticating connecting users. For authenticating domain members, smbd requires winbindd. The smb systemd service starts and stops the smbd daemon.

To use the smbd service, install the samba package.

nmbd

This service provides host name and IP resolution using the NetBIOS over IPv4 protocol. Additionally to the name resolution, the nmbd service enables browsing the SMB network to locate domains, work groups, hosts, file shares, and printers. For this, the service either reports this information directly to the broadcasting client or forwards it to a local or master browser. The nmb systemd service starts and stops the nmbd daemon.

Note that modern SMB networks use DNS to resolve clients and IP addresses. For Kerberos a working DNS setup is required.

To use the nmbd service, install the samba package.

winbindd

This service provides an interface for the Name Service Switch (NSS) to use AD or NT4 domain users and groups on the local system. This enables, for example, domain users to authenticate to services hosted on a Samba server or to other local services. The winbind systemd service starts and stops the winbindd daemon.

If you set up Samba as a domain member, winbindd must be started before the smbd service. Otherwise, domain users and groups are not available to the local system.

To use the winbindd service, install the samba-winbind package.

重要

Red Hat only supports running Samba as a server with the winbindd service to provide domain users and groups to the local system. Due to certain limitations, such as missing Windows access control list (ACL) support and NT LAN Manager (NTLM) fallback, SSSD is not supported.

samba-bgqd
The Samba background queue daemon regularly updates the printer list with printers from CUPS. For print servers with multiple printers, run this daemon. It is managed by the samba-bgqd systemd service. If it fails to run, rpcd_spoolss starts it on demand.

1.1.2. The Samba security services

The security parameter in the [global] section in the /etc/samba/smb.conf file manages how Samba authenticates users that are connecting to the service.

Depending on the mode you install Samba in, the parameter must be set to different values:

On an AD domain member, set security = ads

In this mode, Samba uses Kerberos to authenticate AD users.

For details about setting up Samba as a domain member, see Setting up Samba as an AD domain member server

On a standalone server, set security = user

In this mode, Samba uses a local database to authenticate connecting users.

For details about setting up Samba as a standalone server, see Setting up Samba as a standalone server.

On an NT4 PDC or BDC, set security = user
In this mode, Samba authenticates users to a local or LDAP database.
On an NT4 domain member, set security = domain

In this mode, Samba authenticates connecting users to an NT4 PDC or BDC. You cannot use this mode on AD domain members.

For details about setting up Samba as a domain member, see Setting up Samba as an AD domain member server.

When Samba services and client utilities load or reload configuration files, details triggers for automatic and manual reloads, and certain settings require a full service restart for configuration changes to become effective.

The following describes when Samba services and utilities load and reload their configuration:

  • Samba services reload their configuration:

    • Automatically every 3 minutes
    • On manual request, for example, when you run the smbcontrol all reload-config command.
  • Samba client utilities read their configuration only when you start them.

Note that certain parameters, such as security require a restart of the smb service to take effect and a reload is not sufficient. For more information, refer to:

  • The How configuration changes are applied section in the smb.conf(5) man page on your system
  • smbd(8), nmbd(8), and winbindd(8) man pages on your system

1.1.4. Editing the Samba configuration in a safe way

Samba services automatically reload their configuration every 3 minutes. For details, see Scenarios when Samba services and Samba client utilities load and reload their configuration

To prevent that the services reload the changes before you have verified the configuration using the testparm utility, you can edit the Samba configuration in a safe way.

Prerequisites

  • Samba is installed.

Procedure

  1. Create a copy of the /etc/samba/smb.conf file:

    # cp /etc/samba/smb.conf /etc/samba/samba.conf.copy
  2. Edit the copied file and make the required changes.
  3. Verify the configuration in the /etc/samba/samba.conf.copy file:

    # testparm -s /etc/samba/samba.conf.copy

    If testparm reports errors, fix them and run the command again.

  4. Override the /etc/samba/smb.conf file with the new configuration:

    # mv /etc/samba/samba.conf.copy /etc/samba/smb.conf
  5. Wait until the Samba services automatically reload their configuration or manually reload the configuration:

    # smbcontrol all reload-config
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2026 Red Hat
返回顶部