PDBEDIT(8)

πŸ’– PDBEDIT πŸ’–

okay so <rainbow>pdbedit</rainbow> is a System Administration tool (section 8 of the manual, bestie) and it manages the SAM database β€” that's the Database of Samba Users, iykyk. πŸ‘‘


✨ NAME ✨

pdbedit β€” manage the SAM database (Database of Samba Users) 🫢


🌸 SYNOPSIS 🌸

pdbedit [-L|--list] [-v|--verbose] [-w|--smbpasswd-style]
 [-u|--user=USER] [-N|--account-desc=STRING] [-f|--fullname=STRING]
 [-h|--homedir=STRING] [-D|--drive=STRING] [-S|--script=STRING]
 [-p|--profile=STRING] [-I|--domain=STRING] [-U|--user SID=STRING]
 [-M|--machine SID=STRING] [-a|--create] [-r|--modify] [-m|--machine]
 [-x|--delete] [-b|--backend=STRING] [-i|--import=STRING]
 [-e|--export=STRING] [-g|--group] [-y|--policies] [--policies-reset]
 [-P|--account-policy=STRING] [-C|--value=LONG]
 [-c|--account-control=STRING] [--force-initialized-passwords]
 [-z|--bad-password-count-reset] [-Z|--logon-hours-reset]
 [--time-format=STRING] [-t|--password-from-stdin]
 [-K|--kickoff-time=STRING] [--set-nt-hash=STRING] [-?|--help] [--usage]
 [-d|--debuglevel=DEBUGLEVEL] [--debug-stdout] [--configfile=CONFIGFILE]
 [--option=name=value] [-l|--log-basename=LOGFILEBASE] [--leak-report]
 [--leak-report-full]

πŸ¦‹ DESCRIPTION πŸ¦‹

so this tool is part of the samba(7) suite. cute little family πŸ’œ

the pdbedit program manages the users accounts stored in the sam database, and ngl β€” it can only be run by root. like, root only, fr fr. no sneaking in. 😀

the pdbedit tool uses the passdb modular interface, which means it does not care what kind of users database you're using β€” currently there's smbpasswd, ldap, nis+ and tdb based ones, and more can be added without changing the tool. iconic design honestly, the way that modularity ate. πŸ’…

there are five main ways to use pdbedit:

  1. adding a user account
  2. removing a user account
  3. modifying a user account
  4. listing user accounts
  5. importing users accounts

✨ OPTIONS ✨

  • -L, --list β€” this lists every single user account chillin' in the users database. it prints a list of user/uid pairs separated by the ':' character. πŸ“

Example: pdbedit -L

sorce:500:Simo Sorce
samba:45:Test User
  • -v, --verbose β€” turns on the verbose listing format, so pdbedit lists the users in the database and prints out the account fields in a descriptive format. and if you use it together with -w, it also shows passwords hashes. πŸ‘€

Example: pdbedit -L -v

---------------
username:       sorce
user ID/Group:  500/500
user RID/GRID:  2000/2001
Full Name:      Simo Sorce
Home Directory: \\BERSERKER\sorce
HomeDir Drive:  H:
Logon Script:   \\BERSERKER\netlogon\sorce.bat
Profile Path:   \\BERSERKER\profile
---------------
username:       samba
user ID/Group:  45/45
user RID/GRID:  1090/1091
Full Name:      Test User
Home Directory: \\BERSERKER\samba
HomeDir Drive:
Logon Script:
Profile Path:   \\BERSERKER\profile
  • -w, --smbpasswd-style β€” sets the "smbpasswd" listing format. it makes pdbedit list the users in the database and print out the account fields in a format compatible with the smbpasswd file format (go check smbpasswd(5) for the deets). but if you use it together with (-v) instead, it displays the passwords hashes in verbose output. 🀫

Example: pdbedit -L -w

sorce:500:508818B733CE64BEAAD3B435B51404EE:
          D2A2418EFC466A8A0F6B1DBB5C3DB80C:
          [UX         ]:LCT-00000000:
samba:45:0F2B255F7B67A7A9AAD3B435B51404EE:
          BC281CE3F53B6A5146629CD4751D3490:
          [UX         ]:LCT-3BFA1E8D:
  • -u, --user username β€” specifies the username to be used for whatever operation you asked for (listing, adding, removing). it's required in add, remove and modify operations, and optional in list operations. so basically the main character of half these commands. 🌟
  • -f, --fullname fullname β€” can be used while adding or modifying a user account. it specifies the user's full name.

Example: -f "Simo Sorce"

  • -h, --homedir homedir β€” can be used while adding or modifying a user account. it specifies the user's home directory network path.

Example: -h "\\\\BERSERKER\\sorce"

  • -D, --drive drive β€” can be used while adding or modifying a user account. it specifies the windows drive letter to be used to map the home directory.

Example: -D "H:"

  • -S, --script script β€” can be used while adding or modifying a user account. it specifies the user's logon script path.

Example: -S "\\\\BERSERKER\\netlogon\\sorce.bat"

  • --set-nt-hash β€” can be used while modifying a user account. it sets the user's password using the nt-hash value given as a hexadecimal string. super useful to synchronize passwords. πŸ”

Example: --set-nt-hash 8846F7EAEE8FB117AD06BDD830B7586C

  • -p, --profile profile β€” can be used while adding or modifying a user account. it specifies the user's profile directory.

Example: -p "\\\\BERSERKER\\netlogon"

  • -M, '--machine SID' SID|rid β€” can be used while adding or modifying a machine account. it specifies the machines' new primary group SID (Security Identifier) or rid.

Example: -M S-1-5-21-2447931902-1787058256-3961074038-1201

  • -U, '--user SID' SID|rid β€” can be used while adding or modifying a user account. it specifies the users' new SID (Security Identifier) or rid.

Example: -U S-1-5-21-2447931902-1787058256-3961074038-5004

Example: '--user SID' S-1-5-21-2447931902-1787058256-3961074038-5004

Example: -U 5004

Example: '--user SID' 5004

  • -c, --account-control account-control β€” can be used while adding or modifying a user account. it specifies the users' account control property. the possible flags are, and I quote, listed below πŸ‘‡
    • N: No password required
    • D: Account disabled
    • H: Home directory required
    • T: Temporary duplicate of other account
    • U: Regular user account
    • M: MNS logon user account
    • W: Workstation Trust Account
    • S: Server Trust Account
    • L: Automatic Locking
    • X: Password does not expire
    • I: Domain Trust Account

Example: -c "[X ]"

  • -K, --kickoff-time β€” used to modify the kickoff time for a certain user. use "never" as the argument to set the kickoff time to unlimited. ♾️

Example: pdbedit -K never user

  • -a, --create β€” used to add a user into the database. this command needs a user name specified with the -u switch. when adding a new user, pdbedit will also ask for the password to be used. πŸ”‘

Example: pdbedit -a -u sorce

new password:
retype new password
Note πŸ’€ pdbedit does not call the unix password synchronization script if unix password sync has been set. it only updates the data in the Samba user database. if you wish to add a user and synchronise the password immediately, use smbpasswd's -a option.
  • -t, --password-from-stdin β€” makes pdbedit read the password from standard input instead of from /dev/tty (like the passwd(1) program does). the password has to be submitted twice and terminated by a newline each. πŸ“₯
  • -r, --modify β€” used to modify an existing user in the database. this command needs a user name specified with the -u switch. other options can be specified to modify the properties of the specified user. this flag is kept for backwards compatibility, but ngl it is no longer necessary to specify it. πŸ™ˆ
  • -m, --machine β€” may only be used in conjunction with the -a option. it makes pdbedit add a machine trust account instead of a user account (-u username will provide the machine name).

Example: pdbedit -a -m -u w2k-wks

  • -x, --delete β€” causes pdbedit to delete an account from the database. it needs a username specified with the -u switch. bye bestie πŸ‘‹

Example: pdbedit -x -u bob

  • -i, --import passdb-backend β€” use a different passdb backend to retrieve users than the one specified in smb.conf. can be used to import data into your local user database.

this option will ease migration from one passdb backend to another. 🧳

Example: pdbedit -i smbpasswd:/etc/smbpasswd.old

  • -e, --export passdb-backend β€” exports all currently available users to the specified password database backend.

this option will ease migration from one passdb backend to another and will ease backing up. πŸ’Ύ

Example: pdbedit -e smbpasswd:/root/samba-users.backup

  • -g, --group β€” if you specify -g, then -i in-backend -e out-backend applies to the group mapping instead of the user database.

this option will ease migration from one passdb backend to another and will ease backing up.

  • -b, --backend passdb-backend β€” use a different default passdb backend.

Example: pdbedit -b xml:/root/pdb-backup.xml -l

  • -P, --account-policy account-policy β€” display an account policy. πŸ‘‘

valid policies are: minimum password age, reset count minutes, disconnect time, user must logon to change password, password history, lockout duration, min password length, maximum password age and bad lockout attempt.

Example: pdbedit -P "bad lockout attempt"

account policy value for bad lockout attempt is 0
  • -C, --value account-policy-value β€” sets an account policy to a specified value. this option may only be used in conjunction with the -P option. (they're a package deal, besties 🫢)

Example: pdbedit -P "bad lockout attempt" -C 3

account policy value for bad lockout attempt was 0
account policy value for bad lockout attempt is now 3
  • -y, --policies β€” if you specify -y, then -i in-backend -e out-backend applies to the account policies instead of the user database.

this option will allow one to migrate account policies from their default tdb-store into a passdb backend, e.g. an LDAP directory server. ✨

Example: pdbedit -y -i tdbsam: -e ldapsam:ldap://my.ldap.host

  • --force-initialized-passwords β€” forces all users to change their password upon next login. everybody. all of them. no exceptions. 😭
  • -N, --account-desc description β€” can be used while adding or modifying a user account. it specifies the user's description field.

Example: -N "test description"

  • -Z, --logon-hours-reset β€” can be used while adding or modifying a user account. it resets the user's allowed logon hours, so a user may login at any time afterwards. πŸ• free at last

Example, bestie: -Z. That's the whole vibe πŸ’…

  • -z, --bad-password-count-reset β€” use this when you're adding or modifying a user account and you wanna wipe out that stored bad login counter for the user you picked. fresh start energy ✨ Example: -z
  • --policies-reset β€” resets the general password policies saved for a domain right back to their default values. factory reset but make it domain-wide πŸŽ€ Example: --policies-reset
  • -I, --domain β€” works while adding or modifying a user account, and it sets the user's domain field for you. Example: -I "MYDOMAIN"
  • --time-format β€” okay so this one is literally not being used right now, it's just sitting there 😭
  • -?, --help β€” prints a lil summary of all the command line options. your safety net fr fr 🫢
  • --usage β€” shows a brief usage message. short, sweet, iconic.
  • -d, --debuglevel=level β€” level is an integer from 0 to 10. if you don't specify it, the default is 1 for client applications.

the higher this value, the more detail gets logged to the log files about what the server is doing. at level 0, only critical errors and serious warnings show up. level 1 is the reasonable day-to-day setting β€” it generates a small amount of info about the operations carried out. πŸ‘‘

levels above 1 generate a considerable amount of log data, so only use them when you're investigating a problem. levels above 3 are designed for developers only and generate HUGE amounts of log data, most of which is extremely cryptic πŸ’€

heads up: specifying this parameter right here overrides the log level parameter in the /etc/samba/smb.conf file. no cap.
  • --debug-stdout β€” redirects debug output to STDOUT. by default all clients are logging to STDERR, so this is the glow-up if you want it in the other place ✨
  • --configfile=<configuration file> β€” the file you name here contains the configuration details the client needs. the info in this file can be general for both client and server, or it can only give you client-specific stuff like options such as client smb encrypt. check /etc/samba/smb.conf for more info. the default configuration file name is determined at compile time πŸ¦‹
  • --option=<name>=<value> β€” sets the smb.conf(5) option "<name>" to value "<value>" straight from the command line. this overrides compiled-in defaults and any options read from the configuration file. if a name or a value includes a space, wrap the whole --option=name=value into quotes πŸ’œ
  • -l, --log-basename=logdirectory β€” base directory name for log/debug files. the extension .progname gets appended to it (like log.smbclient, log.smbd, etc...). and note: the log file is never removed by the client 🌸
  • --leak-report β€” turns on talloc leak reporting on exit. tidy queen behavior.
  • --leak-report-full β€” turns on full talloc leak reporting on exit. the deluxe version, obsessed.
  • -V, --version β€” prints the program version number. say hi to the version πŸ‘‹

πŸ“ NOTES

This command may be used only by root. like, literally only root, don't try it as your regular lil user account, it's giving permission denied 😭


🏷️ VERSION

This man page is part of version 4.24.7-Ubuntu-4.24.7+dfsg-1ubuntu1 of the Samba suite. periodt.


πŸ‘€ SEE ALSO

go read those too bestie, iykyk 🫢


✍️ AUTHOR

The original Samba software and related utilities were created by Andrew Tridgell. Samba is now developed by the Samba Team as an Open Source project similar to the way the Linux kernel is developed. legends, honestly πŸ’–

The pdbedit manpage was written by Simo Sorce and Jelmer Vernooij. thank you for your service 🫑


aaaand that's the whole page!! this was Samba 4.24.7-Ubuntu-4.24.7+dfsg-1ubuntu1, dated 09/13/2026, from the PDBEDIT(8) manual πŸ’…βœ¨ go forth and manage those databases, main character πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from