samba-tool

samba-tool is a comprehensive command-line utility that allows administrators to manage and configure various aspects of Samba. It is particularly useful for tasks related to Active Directory (AD) management, domain controllers, and other advanced configurations.

General Usage

samba-tool [command] [subcommand] [options]

samba-tool encompasses a wide range of commands and subcommands for different purposes. Below are some of the most commonly used categories and examples.

Active Directory (AD) Management

  1. Creating a Domain

    samba-tool domain provision --use-rfc2307 --interactive

    This command guides you through the process of creating a new Samba AD domain controller interactively.

  2. Joining a Domain

    samba-tool domain join example.com DC -U"EXAMPLE\administrator"

    This command joins an existing domain as an additional domain controller.

  3. Managing Users

    • Creating a User

      samba-tool user create username password --given-name=John --surname=Doe

      This command creates a new AD user with the specified attributes.

    • Deleting a User

      samba-tool user delete username

      This command deletes an AD user.

    • Changing a User's Password

      samba-tool user setpassword username

      This command prompts to set a new password for the specified user.

  4. Managing Groups

    • Creating a Group

      samba-tool group add groupname

      This command creates a new AD group.

    • Adding a User to a Group

      samba-tool group addmembers groupname username

      This command adds a user to a specified group.

    • Removing a User from a Group

      samba-tool group removemembers groupname username

      This command removes a user from a specified group.

Domain and DNS Management

  1. Listing Domain Controllers

    This command lists all domain controllers in the domain.

  2. Managing DNS Records

    • Adding a DNS Record

      Example:

    • Deleting a DNS Record

      Example:

  3. Forcing a Replication

    Example:

Schema Management

  1. Extending the Schema

    This command upgrades the AD schema to match the schema of a given Windows AD.

  2. Checking Schema

    This command performs various consistency checks on the AD database.

Troubleshooting and Maintenance

  1. Checking the Database

    This command checks the AD database for consistency issues.

  2. Resetting the SYSVOL ACLs

    This command resets the Access Control Lists (ACLs) on the SYSVOL share.

  3. Inspecting Logs

    Example:

    This command sets the log level for Samba components to aid in troubleshooting.

Example Usage Scenarios

  1. Provisioning a New Domain

  2. Creating a New User

  3. Adding a DNS Record

  4. Forcing Replication Between Domain Controllers

  5. Resetting SYSVOL ACLs

Conclusion

samba-tool is a versatile and powerful command-line utility that simplifies the management and administration of Samba, particularly in an Active Directory environment. Whether provisioning domains, managing users and groups, configuring DNS, or troubleshooting, samba-tool provides a comprehensive set of commands to effectively manage Samba servers. Understanding and utilizing these commands can greatly enhance an administrator’s ability to maintain and optimize a Samba-based network infrastructure.

Last updated