> For the complete documentation index, see [llms.txt](https://linux-tutorial-cli.gitbook.io/linux-cli-tutorial/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://linux-tutorial-cli.gitbook.io/linux-cli-tutorial/txt-files/file-systems-cocepts/lpic3-300/wbinfo.md).

# wbinfo

`wbinfo` is a command-line utility that comes with the Samba suite, designed to interact with the Winbind service. Winbind is used to resolve user and group information from Windows NT/Active Directory domains, mapping Windows security identifiers (SIDs) to Unix user IDs (UIDs) and group IDs (GIDs). In essence, `wbinfo` provides a way to query domain-related information from the Samba system, which is invaluable in mixed environments where Linux and Windows systems coexist.

### Key Features and Functions

* **User and Group Enumeration**:
  * **List Domain Users**:\
    Use `wbinfo -u` to list all domain users.

    ```bash
    wbinfo -u
    ```
  * **List Domain Groups**:\
    Use `wbinfo -g` to list all domain groups.

    ```bash
    wbinfo -g
    ```
* **SID to UID/GID Mapping**:
  * **Query User Information**:\
    Retrieve the mapping for a given user.

    ```bash
    wbinfo -i username
    ```

    This command outputs details including the user’s SID and the corresponding Unix UID.
  * **Query Group Information by SID**:\
    You can also use `wbinfo` to query groups by providing the SID.

    ```bash
    wbinfo -n S-1-5-21-...
    ```
* **All-Users and All-Groups Queries**:
  * You can list all users and groups for more extensive audits:

    ```bash
    wbinfo --all-users
    wbinfo --all-groups
    ```
* **Troubleshooting**:
  * `wbinfo` is often used to diagnose issues with domain authentication, group memberships, or SID mappings. It helps verify if Winbind is functioning correctly and if the Samba server is properly integrated into the domain.

### Practical Examples

1. **List All Domain Users**:

   ```bash
   wbinfo -u
   ```

   This returns a list of all user accounts in the domain, which can help verify that the domain membership is recognized.
2. **List All Domain Groups**:

   ```bash
   wbinfo -g
   ```

   Useful for checking group configurations and memberships.
3. **Query Specific User Mapping**:

   ```bash
   wbinfo -i john.doe
   ```

   Displays detailed information about `john.doe`, including their SID and the corresponding Unix UID.
4. **Check Mapping for a Specific SID**:

   ```bash
   wbinfo -n S-1-5-21-123456789-234567890-345678901-1001
   ```

   This can be used to confirm that a Windows SID maps to the expected Unix user or group.

### Quantitative and Community Analysis

* **StackOverflow and Forums**:\
  Questions regarding Winbind and `wbinfo` are common on platforms like StackOverflow and ServerFault. There are hundreds of threads where administrators troubleshoot issues like misconfigured domain memberships, SID mapping errors, and integration problems between Samba and Active Directory. This consistent discussion indicates that while `wbinfo` is a powerful tool, its proper configuration is crucial and sometimes challenging.
* **GitHub and Open Source Projects**:\
  Although the Samba project itself is maintained across various repositories (with Samba being a mature, decades-old project), numerous scripts and wrapper tools on GitHub reference `wbinfo` for automating user/group queries in mixed environments. Many of these projects have received significant attention, reflecting the tool's relevance in the enterprise ecosystem.
* **Hacker News and Technical Blogs**:\
  Discussions on platforms like Hacker News often cite Samba and its components (including `wbinfo`) when addressing issues related to integrating Linux systems with Active Directory. Articles and blog posts typically highlight the robustness of Winbind and `wbinfo` but also note that configuration can be intricate, especially in large-scale or complex network environments.

### Benefits and Shortcomings

**Benefits**:

* **Seamless Integration**: Provides robust integration with Windows domain services, allowing Unix-like systems to effectively participate in Windows-centric environments.
* **Detailed Diagnostics**: Offers detailed mapping information, which is invaluable for troubleshooting authentication and group membership issues.
* **Mature and Widely Tested**: As part of the long-established Samba suite, `wbinfo` has been refined over many years, making it a reliable tool in production environments.

**Shortcomings**:

* **Complex Configuration**: Setting up Winbind and ensuring that `wbinfo` returns accurate information can be challenging, especially in complex AD environments.
* **Performance Overheads**: In very large domains, enumerating all users or groups can be resource-intensive.
* **Documentation Variability**: While extensive, documentation can sometimes be scattered across different sources, making initial setup a hurdle for newcomers.

### Conclusion

In summary, `wbinfo` is an essential utility for administrators managing Samba in Active Directory environments. It facilitates the enumeration and mapping of Windows users and groups to Unix IDs, playing a critical role in ensuring seamless interoperability between Linux and Windows systems. Although its configuration may be complex, the extensive community support and numerous troubleshooting resources available on StackOverflow, GitHub, and technical blogs underscore its importance and reliability in enterprise deployments.

By understanding and effectively using `wbinfo`, administrators can significantly streamline domain user and group management, leading to more efficient and secure network operations.
