samba-tool — Main Samba administration tool.
samba-tool
[-h] [-W myworkgroup] [-U user] [-d debuglevel] [--v]
Show this help message and exit
Set the realm for the domain.
Note that specifying this parameter here will override
the realm parameter in the
${prefix}/etc/smb.conf
file.
DN to use for a simple bind.
Specify the password on the commandline.
Be cautious about including passwords in
scripts or passing user-supplied values onto
the command line. For security it is better to
let the Samba client tool ask for the password
if needed, or obtain the password once with
kinit
.
If --password is not specified,
the tool will check the PASSWD
environment variable, followed by PASSWD_FD
which is expected to contain an open
file descriptor (FD) number.
Finally it will check PASSWD_FILE
(containing
a file path to be opened). The file should only
contain the password. Make certain that the
permissions on the file restrict
access from unwanted users!
While Samba will attempt to scrub the password from the process title (as seen in ps), this is after startup and so is subject to a race.
Sets the SMB username or username and password.
If %PASSWORD is not specified, the user will be
prompted. The client will first check the
USER
environment variable
(which is also permitted to also contain the
password separated by a %), then the
LOGNAME
variable (which is not
permitted to contain a password) and if either exists,
the value is used. If these environmental
variables are not found, the username
found in a Kerberos Credentials cache may be used.
A third option is to use a credentials file which
contains the plaintext of the username and password.
This option is mainly provided for scripts where the
admin does not wish to pass the credentials on the
command line or via environment variables. If this
method is used, make certain that the permissions on
the file restrict access from unwanted users. See the
-A
for more details.
Be cautious about including passwords in scripts
or passing user-supplied values onto the command line. For
security it is better to let the Samba client tool ask for the
password if needed, or obtain the password once with kinit
.
While Samba will attempt to scrub the password from the process title (as seen in ps), this is after startup and so is subject to a race.
Set the SMB domain of the username. This overrides the default domain which is the domain defined in smb.conf. If the domain specified is the same as the servers NetBIOS name, it causes the client to log on using the servers local SAM (as opposed to the Domain SAM).
Note that specifying this parameter here will override
the workgroup parameter in the
${prefix}/etc/smb.conf
file.
If specified, this parameter suppresses the normal password prompt from the client to the user. This is useful when accessing a service that does not require a password.
Unless a password is specified on the command line or this parameter is specified, the client will request a password.
If a password is specified on the command line and this option is also defined the password on the command line will be silently ignored and no password will be used.
This parameter determines whether Samba client tools will try to authenticate using Kerberos. For Kerberos authentication you need to use dns names instead of IP addresses when connecting to a service.
Note that specifying this parameter here will override
the client use kerberos
parameter in the ${prefix}/etc/smb.conf
file.
Specifies the credential cache location for Kerberos authentication.
This will set --use-kerberos=required too.
This option allows you to specify a file from which to read the username and password used in the connection. The format of the file is:
username = <value> password = <value> domain = <value>
Make certain that the permissions on the file restrict access from unwanted users!
IP address of the server
Indicate whether samba-tool should use ANSI colour codes in its output. If 'auto' (the default), samba-tool will use colour when its output is directed toward a terminal, unless the NO_COLOR environment variable is set and non-empty.
The values 'yes' and 'force' are accepted as synonyms for 'always'; 'no' and 'none' for 'never'; and 'tty' and 'if-tty' for 'auto'.
Note that asking for colour doesn't mean samba-tool will necessarily be very colourful. Many commands are very monochrome, particularly when successful.
level
is an integer from 0
to 10. The default value if this parameter is not
specified is 1 for client applications.
The higher this value, the more detail will be logged to the log files about the activities of the server. At level 0, only critical errors and serious warnings will be logged. Level 1 is a reasonable level for day-to-day running - it generates a small amount of information about operations carried out.
Levels above 1 will generate considerable amounts of log data, and should only be used when investigating a problem. Levels above 3 are designed for use only by developers and generate HUGE amounts of log data, most of which is extremely cryptic.
Note that specifying this parameter here will override
the log level parameter in the
${prefix}/etc/smb.conf
file.
This will redirect debug output to STDOUT. By default all clients are logging to STDERR.
computername
[options]Add a new computer to the Active Directory Domain.
The new computer name specified on the command is the sAMAccountName, with or without the trailing dollar sign.
DN of alternative location (with or without domainDN counterpart) to default CN=Computers in which new computer object will be created. E.g. 'OU=OUname'.
The new computer's description.
IPv4 address for the computer's A record, or IPv6 address for AAAA record, can be provided multiple times.
Computer's Service Principal Name, can be provided multiple times.
Prepare enabled machine account for oldjoin mechanism.
computername
[options]Add a new computer. This is a synonym for the
samba-tool computer add
command and is available
for compatibility reasons only. Please use
samba-tool computer add
instead.
computername
[options]Delete an existing computer account.
The computer name specified on the command is the sAMAccountName, with or without the trailing dollar sign.
computername
Edit a computer AD object.
The computer name specified on the command is the sAMAccountName, with or without the trailing dollar sign.
Specifies the editor to use instead of the system default, or 'vi' if no system default is set.
computername
new_parent_dn
[options]This command moves a computer account into the specified organizational unit or container.
The computername specified on the command is the sAMAccountName, with or without the trailing dollar sign.
The name of the organizational unit or container can be specified as a full DN or without the domainDN component.
computername
[options]Display a computer AD object.
The computer name specified on the command is the sAMAccountName, with or without the trailing dollar sign.
Comma separated list of attributes, which will be printed.
contactname
] [options]Add a new contact to the Active Directory Domain.
The name of the new contact can be specified by the first argument 'contactname' or the --given-name, --initial and --surname arguments. If no 'contactname' is given, contact's name will be made up of the given arguments by combining the given-name, initials and surname. Each argument is optional. A dot ('.') will be appended to the initials automatically.
DN of alternative location (with or without domainDN counterpart) in which the new contact will be created. E.g. 'OU=OUname'. Default is the domain base.
The new contact's description.
Contact's surname.
Contact's given name.
Contact's initials.
Contact's display name.
Contact's job title.
Contact's department.
Contact's company.
Contact's email address.
Contact's home page.
Contact's phone number.
Contact's mobile phone number.
Contact's office location.
contactname
] [options]Add a new contact. This is a synonym for the
samba-tool contact add
command and is available
for compatibility reasons only. Please use
samba-tool contact add
instead.
contactname
[options]Delete an existing contact.
The contactname specified on the command is the common name or the distinguished name of the contact object. The distinguished name of the contact can be specified with or without the domainDN component.
contactname
Modify a contact AD object.
The contactname specified on the command is the common name or the distinguished name of the contact object. The distinguished name of the contact can be specified with or without the domainDN component.
Specifies the editor to use instead of the system default, or 'vi' if no system default is set.
contactname
new_parent_dn
[options]This command moves a contact into the specified organizational unit or container.
The contactname specified on the command is the common name or the distinguished name of the contact object. The distinguished name of the contact can be specified with or without the domainDN component.
contactname
[options]Display a contact AD object.
The contactname specified on the command is the common name or the distinguished name of the contact object. The distinguished name of the contact can be specified with or without the domainDN component.
Comma separated list of attributes, which will be printed.
contactname
[options]Rename a contact and related attributes.
This command allows to set the contact's name related attributes. The contact's CN will be renamed automatically. The contact's new CN will be made up by combining the given-name, initials and surname. A dot ('.') will be appended to the initials automatically, if required. Use the --force-new-cn option to specify the new CN manually and --reset-cn to reset this change.
Use an empty attribute value to remove the specified attribute.
The contact name specified on the command is the CN.
New surname.
New given name.
New initials.
Specify a new CN (RDN) instead of using a combination of the given name, initials and surname.
Set the CN to the default combination of given name, initials and surname.
New display name.
New email address.
accountname
principal
[options]Add a service principal as msDS-AllowedToDelegateTo.
accountname
principal
[options]Delete a service principal as msDS-AllowedToDelegateTo.
accountname
[(on|off)] [options]Set/unset UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION (S4U2Proxy) for an account.
accountname
[(on|off)] [options]Set/unset UF_TRUSTED_FOR_DELEGATION for an account.
List authentication policies on the domain.
LDB URL for database or target server.
View authentication policies as JSON instead of a list.
View an authentication policy on the domain.
LDB URL for database or target server.
Name of the authentication policy to view (required).
Create authentication policies on the domain.
LDB URL for database or target server.
Name of the authentication policy (required).
Optional description for the authentication policy.
Protect authentication policy from accidental deletion.
Cannot be used together with --unprotect.
Unprotect authentication policy from accidental deletion.
Cannot be used together with --protect.
Only audit authentication policy.
Cannot be used together with --enforce.
Enforce authentication policy.
Cannot be used together with --audit.
Strong NTLM Policy (Disabled, Optional, Required).
Ticket-Granting-Ticket lifetime for user accounts.
Allow NTLM
and
Interactive NETLOGON SamLogon
authentication despite the
fact that
allowed-to-authenticate-from
is in use, which would
otherwise restrict the user to selected devices.
Conditions a device must meet for users covered by this policy to be allowed to authenticate. While this is a restriction on the device, any conditional ACE rules are expressed as if the device was a user.
Must be a valid SDDL string without reference to Device keywords.
Example: O:SYG:SYD:(XA;OICI;CR;;;WD;(Member_of {SID(AU)}))
This policy, applying to a user account that is offering a service, eg a web server with a user account, restricts which accounts may access it.
Must be a valid SDDL string. The SDDL can reference both bare (user) and Device conditions.
SDDL Example: O:SYG:SYD:(XA;OICI;CR;;;WD;(Member_of {SID(AO)}))
Ticket-Granting-Ticket lifetime for service accounts.
Allow NTLM network authentication when service is restricted to selected devices.
Conditions a device must meet for service accounts covered by this policy to be allowed to authenticate. While this is a restriction on the device, any conditional ACE rules are expressed as if the device was a user.
Must be a valid SDDL string without reference to Device keywords.
SDDL Example: O:SYG:SYD:(XA;OICI;CR;;;WD;(Member_of {SID(AU)}))
This policy, applying to a service account (eg a Managed Service Account, Group Managed Service Account), restricts which accounts may access it.
Must be a valid SDDL string. The SDDL can reference both bare (user) and Device conditions.
SDDL Example: O:SYG:SYD:(XA;OICI;CR;;;WD;(Member_of {SID(AO)}))
Ticket-Granting-Ticket lifetime for computer accounts.
This policy, applying to a computer account (eg a server or workstation), restricts which accounts may access it.
Must be a valid SDDL string. The SDDL can reference both bare (user) and Device conditions.
SDDL Example: O:SYG:SYD:(XA;OICI;CR;;;WD;(Member_of {SID(AO)}))
Modify authentication policies on the domain. The same
options apply as for domain auth policy create
.
Delete authentication policies on the domain.
LDB URL for database or target server.
Name of authentication policy to delete (required).
Force authentication policy delete even if it is protected.
Set the user-allowed-to-authenticate-from property by scenario.
LDB URL for database or target server.
Name of authentication policy.
User is allowed to
authenticate, if the device they
authenticate from is assigned
and granted membership of a
given GROUP
.
User is allowed to
authenticate, if the device they
authenticate from is assigned
and granted membership of a
given SILO
.
Set the user-allowed-to-authenticate-to property by scenario.
LDB URL for database or target server.
Name of authentication policy.
The user account, offering a
network service, covered by
this policy, will only be allowed
access from other accounts
that are members of the given
GROUP
.
The user account, offering a
network service, covered by
this policy, will only be
allowed access from other accounts
that are assigned to,
granted membership of (and
meet any authentication
conditions of) the given SILO
.
Set the service-allowed-to-authenticate-from property by scenario.
LDB URL for database or target server.
Name of authentication policy.
The service account (eg a Managed
Service Account, Group Managed
Service Account) is allowed to
authenticate, if the device it
authenticates from is a member
of the given GROUP
.
The service account (eg a Managed
Service Account, Group Managed
Service Account) is allowed to
authenticate, if the device it
authenticates from is assigned
and granted membership of a
given SILO
.
Set the service-allowed-to-authenticate-to property by scenario.
LDB URL for database or target server.
Name of authentication policy.
The service account (eg a Managed
Service Account, Group Managed
Service Account), will only be
allowed access by other accounts
that are members of the given
GROUP
.
The service account (eg a
Managed Service Account, Group
Managed Service Account), will
only be allowed access by other
accounts that are assigned
to, granted membership of (and
meet any authentication
conditions of) the given SILO
.
Set the computer-allowed-to-authenticate-to property by scenario.
LDB URL for database or target server.
Name of authentication policy.
The computer account (eg a server
or workstation), will only be
allowed access by other accounts
that are members of the given
GROUP
.
The computer account (eg a
server or workstation), will
only be allowed access by
other accounts that are
assigned to, granted
membership of (and meet any
authentication conditions of)
the given SILO
.
List authentication silos on the domain.
LDB URL for database or target server.
View authentication silos as JSON instead of a list.
View an authentication silo on the domain.
LDB URL for database or target server.
Name of the authentication silo to view (required).
Create authentication silos on the domain.
LDB URL for database or target server.
Name of the authentication silo (required).
Optional description for the authentication silo.
User account authentication policy.
Managed service account authentication policy.
Computer authentication policy.
Protect authentication silo from accidental deletion.
Cannot be used together with --unprotect.
Unprotect authentication silo from accidental deletion.
Cannot be used together with --protect.
Only audit silo policies.
Cannot be used together with --enforce.
Enforce silo policies.
Cannot be used together with --audit.
Modify authentication silos on the domain.
LDB URL for database or target server.
Name of the authentication silo (required).
Optional description for the authentication silo.
User account authentication policy.
Managed service account authentication policy.
Computer authentication policy.
Protect authentication silo from accidental deletion.
Cannot be used together with --unprotect.
Unprotect authentication silo from accidental deletion.
Cannot be used together with --protect.
Only audit silo policies.
Cannot be used together with --enforce.
Enforce silo policies.
Cannot be used together with --audit.
Delete authentication silos on the domain.
LDB URL for database or target server.
Name of authentication silo to delete (required).
Force authentication silo delete even if it is protected.
Grant a member access to an authentication silo.
LDB URL for database or target server.
Name of authentication silo (required).
Member to grant access to the silo (DN or account name).
List members in an authentication silo.
LDB URL for database or target server.
Name of authentication silo (required).
View members as JSON instead of a list.
Revoke a member from an authentication silo.
LDB URL for database or target server.
Name of authentication silo (required).
Member to revoke from the silo (DN or account name).
List claim types on the domain.
LDB URL for database or target server.
View claim types as JSON instead of a list.
View a single claim type on the domain.
LDB URL for database or target server.
Display name of claim type to view (required).
Create claim types on the domain.
LDB URL for database or target server.
Attribute of claim type to create (required).
Object classes to set claim type to.
Example: --class=user --class=computer
Optional display name or use attribute name.
Optional description or use from attribute.
Enable claim type.
Cannot be used together with --disable.
Disable claim type.
Cannot be used together with --enable.
Protect claim type from accidental deletion.
Cannot be used together with --unprotect.
Unprotect claim type from accidental deletion.
Cannot be used together with --protect.
Modify claim types on the domain.
LDB URL for database or target server.
Display name of claim type to modify (required).
Object classes to set claim type to.
Example: --class=user --class=computer
Set the claim type description.
Enable claim type.
Cannot be used together with --disable.
Disable claim type.
Cannot be used together with --enable.
Protect claim type from accidental deletion.
Cannot be used together with --unprotect.
Unprotect claim type from accidental deletion.
Cannot be used together with --protect.
Delete claim types on the domain.
LDB URL for database or target server.
Display name of claim type to delete (required).
Force claim type delete even if it is protected.
List claim value types on the domain.
LDB URL for database or target server.
View claim value types as JSON instead of a list.
View a single claim value type on the domain.
LDB URL for database or target server.
Display name of claim value type to view (required).
List service accounts on the domain.
LDB URL for database or target server.
View service accounts as JSON instead of a list.
View a single service account on the domain.
LDB URL for database or target server.
Account name of service account to view (required).
Create a new service account on the domain.
LDB URL for database or target server.
Account name of service account (required).
DNS hostname of this service account (required).
Optional Group MSA Membership SDDL.
Managed password refresh interval in days.
Modify an existing service account on the domain.
LDB URL for database or target server.
Account name of service account (required).
Update DNS hostname of this service account.
Update Group MSA Membership SDDL.
Delete a service accounts on the domain.
LDB URL for database or target server.
Account name of service account to delete.
Display Group MSA Membership for a service account.
LDB URL for database or target server.
Account name of service account (required).
Return as JSON instead of a list.
Add a principal to Group MSA Membership for a service account.
LDB URL for database or target server.
Account name of service account (required).
Name, DN or SID of principal to add.
Remove a principal from Group MSA Membership for a service account.
LDB URL for database or target server.
Account name of service account (required).
Name, DN or SID of principal to remove.
classic_smb_conf
Upgrade from Samba classic (NT4-like) database to Samba AD DC database.
dnsdomain
[DC|RODC] [options]Promote an existing domain member or NT4 PDC to an AD DC.
dnsdomain
[DC|RODC|MEMBER|SUBDOMAIN] [options]Join a domain as either member or backup domain controller.
pso-name
user-or-group-name
[options]Applies a PSO's password policy to a user or group.
pso-name
precedence
[options]Creates a new Password Settings Object (PSO).
pso-name
[options]Displays the Password Settings that apply to a user.
pso-name
user-or-group-name
[options]Updates a PSO to no longer apply to a user or group.
Show replication status. The [--json] option results in JSON output, and with the [--summary] option produces very little output when the replication status seems healthy.
VALUE
Modify dsheuristics directory_service configuration for the forest.
groupname
[options]Add a new AD group. This is a synonym for the
samba-tool group add
command and is available
for compatibility reasons only. Please use
samba-tool group add
instead.
groupname
Edit a group AD object.
Specifies the editor to use instead of the system default, or 'vi' if no system default is set.
groupname
[options]List all members of the specified AD group.
By default the sAMAccountNames are listed. If no sAMAccountName is available, the CN will be used instead.
List the distinguished names instead of the sAMAccountNames.
Do not list expired group members.
Do not list disabled group members.
groupname
new_parent_dn
[options]This command moves a group into the specified organizational unit or container.
The groupname specified on the command is the sAMAccountName.
The name of the organizational unit or container can be specified as a full DN or without the domainDN component.
groupname
[options]Rename a group and related attributes.
This command allows to set the group's name related attributes. The group's CN will be renamed automatically. The group's CN will be the sAMAccountName. Use the --force-new-cn option to specify the new CN manually and the --reset-cn to reset this change.
Use an empty attribute value to remove the specified attribute.
The groupname specified on the command is the sAMAccountName.
Specify a new CN (RDN) instead of using the sAMAccountName.
Set the CN to the sAMAccountName.
New mail address
New account name (sAMAccountName/logon name)
URL1
URL2
domain|configuration|schema|dnsdomain|dnsforest
[options] Compare two LDAP databases.
original-domain-SID
new-domain-SID
file
[options]Change the domain SID for ACLs. Can be used to change all entries in acl_xattr when the machine's SID has accidentally changed or the data set has been copied to another machine either via backup/restore or rsync.
Set the ACLs directly to the TDB or xattr. The POSIX permissions will NOT be changed, only the NT ACL will be stored.
Specify the name of the smb.conf service to use. This option is required in combination with the --use-s3fs option.
Set the ACLs for use with the default s3fs file server via the VFS layer. This option requires a smb.conf service, specified by the --service=SERVICE option.
Specify the xattr backend type (native fs or tdb).
Name of the tdb file where attributes are stored.
Set the ACLs for directories and their contents recursively.
Follow symlinks when --recursive is specified.
Verbosely list files and ACLs which are being processed.
ou_dn
[options]Add a new organizational unit.
The name of the organizational unit can be specified as a full DN or without the domainDN component.
Specify OU's description.
ou_dn
[options]Add a new organizational unit. This is a synonym for the
samba-tool ou add
command and is available
for compatibility reasons only. Please use
samba-tool ou add
instead.
ou_dn
[options]Delete an organizational unit.
The name of the organizational unit can be specified as a full DN or without the domainDN component.
Delete organizational unit and all children recursively.
ou_dn
[options]List all objects in an organizational unit.
The name of the organizational unit can be specified as a full DN or without the domainDN component.
Display DNs including the base DN.
List objects recursively.
old_ou_dn
new_parent_dn
[options]Move an organizational unit.
The name of the organizational units can be specified as a full DN or without the domainDN component.
old_ou_dn
new_ou_dn
[options]Rename an organizational unit.
The name of the organizational units can be specified as a full DN or without the domainDN component.
attribute
[options]Show objectclasses that MAY or MUST contain this attribute.
Opens an interactive Python shell for Samba ldb connection.
LDB URL for database or target server.
username
[password
]Add a new user. This is a synonym for the
samba-tool user add
command and is available
for compatibility reasons only. Please use
samba-tool user add
instead.
username
Edit a user account AD object.
Specifies the editor to use instead of the system default, or 'vi' if no system default is set.
List all users.
By default the user's sAMAccountNames are listed.
List user's distinguished names instead of the sAMAccountNames.
Specify base DN to use. Only users under the specified base DN will be listed.
Do not list expired user accounts.
Do not list disabled user accounts.
Only list locked user accounts.
username
[options]Display a user AD object.
Comma separated list of attributes, which will be printed.
username
new_parent_dn
[options]This command moves a user account into the specified organizational unit or container.
The username specified on the command is the sAMAccountName.
The name of the organizational unit or container can be specified as a full DN or without the domainDN component.
username
[options]Rename a user and related attributes.
This command allows to set the user's name related attributes. The user's CN will be renamed automatically. The user's new CN will be made up by combining the given-name, initials and surname. A dot ('.') will be appended to the initials automatically, if required. Use the --force-new-cn option to specify the new CN manually and --reset-cn to reset this change.
Use an empty attribute value to remove the specified attribute.
The username specified on the command is the sAMAccountName.
New surname
New given name
New initials
Specify a new CN (RDN) instead of using a combination of the given name, initials and surname.
Set the CN to the default combination of given name, initials and surname.
New display name
New email address
New account name (sAMAccountName/logon name)
New user principal name
--cache-ldb-initialize
[options]Syncs the passwords of all user accounts, using an optional script.
Note that this command should run on a single domain controller only (typically the PDC-emulator).
username
[options]Set assigned authentication policy for user.
Name of authentication policy to assign or leave empty to remove.
username
[options]Set assigned authentication silo for user.
Name of authentication silo to assign or leave empty to remove.
domain
Join and synchronise a remote AD domain to the local server.
Please note that samba-tool vampire
is deprecated,
please use samba-tool domain join
instead.
subcommand
Produce graphical representations of Samba network state. To work out what is happening in a replication graph, it is sometimes helpful to use visualisations.
There are two subcommands, two graphical modes, and (roughly) two modes of operation with respect to the location of authority.
Looks at NTDS connections.
Looks at repsTo and repsFrom objects.
Looks at replication lag as shown by the uptodateness vectors.
Distances between DCs are shown in a matrix in the terminal.
Generate Graphviz dot output (for ntdsconn and reps modes). When viewed using dot or xdot, this shows the network as a graph with DCs as vertices and connections edges. Certain types of degenerate edges are shown in different colours or line-styles.
Generate Graphviz dot output as with
[--dot] and attempt to view it
immediately using /usr/bin/xdot
.
Normally,
samba-tool
talks to one database;
with the [-r] option attempts
are made to contact all the DCs known to the first
database. This is necessary for samba-tool
visualize uptodateness
and for
samba-tool visualize reps
because
the repsFrom/To objects are not replicated, and it can
reveal replication issues in other modes.