pdbedit
The pdbedit
command is a utility in Samba used to manage and administer the Samba Passdb (Password Database). This command is primarily used for managing Samba user accounts and their attributes, such as adding, modifying, or deleting users, changing passwords, and viewing user details. It is particularly useful when Samba is being used as a file server or domain controller.
pdbedit
operates directly on the Samba user database, which can either be stored in TDB (Trivial Database) files (such as passdb.tdb
) or external backends like LDAP when Samba is configured for a domain controller.
Key Features of pdbedit
:
pdbedit
:Add, Modify, and Delete Users: It allows administrators to manage user accounts within the Samba database.
View User Information: You can view various attributes of a Samba user account, such as their SID (Security Identifier), last password change time, and more.
Password Management: You can use
pdbedit
to change or expire passwords, or set password policies.Support for Multiple Backends: It works with Samba's default TDB backend as well as external directories like LDAP when Samba is configured to use them.
General Syntax:
Where:
[OPTIONS]
: Various options to specify the action you want to perform.[USER]
: The username or user ID you want to modify or query.
Common pdbedit
Commands:
pdbedit
Commands:Listing Samba Users: To list all users in the Samba password database, simply use the following command:
-L
: Lists all Samba users in the database.
Viewing User Information: To view detailed information about a specific user:
-v
: Provides detailed information about the specified user, including their SID, password expiration time, last password change, and more.
Adding a New User: To add a new user to Samba’s password database:
-a
: Adds a new user.After running this command, you'll typically be prompted to set a password for the new user.
Changing a User’s Password: To change the password of a user:
-r
: Resets the password for the specified user.You'll be prompted to enter the new password.
Deleting a User: To delete a user from the Samba password database:
-x
: Deletes the specified user.
Viewing Specific User’s SID: To view the SID (Security Identifier) for a specific user:
-s
: Displays the SID for the specified user.
Exporting User Data: To export the entire user database to an LDIF file or another format:
-e
: Specifies the export format and target file.
Setting Password Expiry for a User: To set the password expiry for a user:
-P
: Marks the user’s password to expire.
Options:
-h
or--help
: Displays help information for thepdbedit
command.-L
: Lists all users in the password database.-v
: Provides verbose output, showing detailed user information.-a
: Adds a new user to the database.-x
: Deletes a user from the database.-s
: Displays the SID (Security Identifier) of a user.-r
: Resets a user’s password.-P
: Sets a user’s password to expire.
Example Usage:
List all Samba users:
This will list all the users in the Samba password database.
View detailed information for a specific user (
john.doe
):Add a new user (
jane.doe
):This will add
jane.doe
to the Samba database, prompting you to set a password.Change the password for
john.doe
:This will allow you to reset the password for
john.doe
.Delete the user
john.doe
from the database:This will permanently delete
john.doe
from the Samba password database.Export the user database to an LDIF file:
Practical Use Cases:
Managing User Accounts: When Samba is used in a network environment, managing user accounts through
pdbedit
is crucial for maintaining access control. You can create new users, modify their information, or delete accounts.Domain Controller Management: In Samba's Active Directory Domain Controller mode,
pdbedit
can be used to administer domain user accounts, set password policies, and manage group memberships.Password and Security Management: You can use
pdbedit
to reset user passwords, enforce password expiration, and view the account details for troubleshooting or auditing purposes.Bulk User Creation: For bulk user account creation or updates,
pdbedit
can be scripted to automate the process, especially useful in larger environments or when migrating from other systems.
Conclusion:
The pdbedit
command is a powerful utility for managing Samba's password database. It allows administrators to add, modify, and delete users, as well as perform various administrative tasks related to Samba user accounts. Whether managing a Samba file server or a domain controller, pdbedit
is an essential tool for user and password management, making it an important part of any Samba administrator's toolkit.
Last updated