'\" t .\" Title: adcli .\" Author: Stef Walter .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 11/24/2023 .\" Manual: System Commands .\" Source: realmd .\" Language: English .\" .TH "ADCLI" "8" "" "realmd" "System Commands" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" adcli \- Tool for performing actions on an Active Directory domain .SH "SYNOPSIS" .HP \w'\fBadcli\ info\fR\ 'u \fBadcli info\fR domain\&.example\&.com .HP \w'\fBadcli\ join\fR\ 'u \fBadcli join\fR domain\&.example\&.com .HP \w'\fBadcli\ update\fR\ 'u \fBadcli update\fR .HP \w'\fBadcli\ testjoin\fR\ 'u \fBadcli testjoin\fR .HP \w'\fBadcli\ create\-user\fR\ 'u \fBadcli create\-user\fR [\-\-domain=domain\&.example\&.com] user .HP \w'\fBadcli\ delete\-user\fR\ 'u \fBadcli delete\-user\fR [\-\-domain=domain\&.example\&.com] user .HP \w'\fBadcli\ passwd\-user\fR\ 'u \fBadcli passwd\-user\fR [\-\-domain=domain\&.example\&.com] user .HP \w'\fBadcli\ create\-group\fR\ 'u \fBadcli create\-group\fR [\-\-domain=domain\&.example\&.com] user .HP \w'\fBadcli\ delete\-group\fR\ 'u \fBadcli delete\-group\fR [\-\-domain=domain\&.example\&.com] user .HP \w'\fBadcli\ add\-member\fR\ 'u \fBadcli add\-member\fR [\-\-domain=domain\&.example\&.com] group user\ or\ computer... .HP \w'\fBadcli\ remove\-member\fR\ 'u \fBadcli remove\-member\fR [\-\-domain=domain\&.example\&.com] group user... .HP \w'\fBadcli\ preset\-computer\fR\ 'u \fBadcli preset\-computer\fR [\-\-domain=domain\&.example\&.com] computer... .HP \w'\fBadcli\ reset\-computer\fR\ 'u \fBadcli reset\-computer\fR [\-\-domain=domain\&.example\&.com] computer .HP \w'\fBadcli\ delete\-computer\fR\ 'u \fBadcli delete\-computer\fR [\-\-domain=domain\&.example\&.com] computer .HP \w'\fBadcli\ show\-computer\fR\ 'u \fBadcli show\-computer\fR [\-\-domain=domain\&.example\&.com] computer .HP \w'\fBadcli\ create\-msa\fR\ 'u \fBadcli create\-msa\fR [\-\-domain=domain\&.example\&.com] .SH "GENERAL OVERVIEW" .PP \fBadcli\fR is a command line tool that can perform actions in an Active Directory domain\&. Among other things it can be used to join a computer to a domain\&. .PP See the various sub commands below\&. The following global options can be used: .PP \fB\-D, \-\-domain=\fR\fB\fIdomain\fR\fR .RS 4 The domain to connect to\&. If a domain is not specified, then the domain part of the local computer\*(Aqs host name is used\&. .RE .PP \fB\-R, \-\-domain\-realm=\fR\fB\fIREALM\fR\fR .RS 4 Kerberos realm for the domain\&. If not specified, then the upper cased domain name is used\&. .RE .PP \fB\-S, \-\-domain\-controller=\fR\fB\fIserver\fR\fR .RS 4 Connect to a specific domain controller\&. If not specified, then an appropriate domain controller is automatically discovered\&. .RE .PP \fB\-\-use\-ldaps\fR .RS 4 Connect to the domain controller with LDAPS\&. By default the LDAP port is used and SASL GSS\-SPNEGO or GSSAPI is used for authentication and to establish encryption\&. This should satisfy all requirements set on the server side and LDAPS should only be used if the LDAP port is not accessible due to firewalls or other reasons\&. .sp Please note that the place where CA certificates can be found to validate the AD DC certificates must be configured in the OpenLDAP configuration file, e\&.g\&. /etc/openldap/ldap\&.conf\&. As an alternative it can be specified with the help of an environment variable, e\&.g\&. .sp .if n \{\ .RS 4 .\} .nf $ LDAPTLS_CACERT=/path/to/ad_dc_ca_cert\&.pem adcli join \-\-use\-ldaps \-D domain\&.example\&.com \&.\&.\&. .fi .if n \{\ .RE .\} .sp Please see \fBldap.conf\fR(5) for details\&. .RE .PP \fB\-C\fR .RS 4 Use the default Kerberos credential cache to authenticate with the domain\&. .RE .PP \fB\-\-login\-ccache\fR\fB\fI[=ccache_name]\fR\fR .RS 4 Use the specified Kerberos credential cache to authenticate with the domain\&. If no credential cache is specified, the default Kerberos credential cache will be used\&. Credential caches of type FILE can be given with the path to the file\&. For other credential cache types, e\&.g\&. DIR, KEYRING or KCM, the type must be specified explicitly together with a suitable identifier\&. .sp Please note that since the \fIccache_name\fR is optional the =(equal) sign is mandatory\&. If = is missing the parameter is treated as optionless extra argument\&. How this is handled depends on the specific sub\-command\&. .RE .PP \fB\-U, \-\-login\-user=\fR\fB\fIUser\fR\fR .RS 4 Use the specified user account to authenticate with the domain\&. If not specified, then the name \*(AqAdministrator\*(Aq will be used\&. .RE .PP \fB\-\-no\-password\fR .RS 4 Don\*(Aqt show prompts for or read a password from input\&. .RE .PP \fB\-W, \-\-prompt\-password\fR .RS 4 Prompt for a password if necessary\&. This is the default\&. .RE .PP \fB\-\-stdin\-password\fR .RS 4 Read a password from stdin input instead of prompting for a password\&. .RE .PP \fB\-v, \-\-verbose\fR .RS 4 Run in verbose mode with debug output\&. .RE .SH "QUERYING DOMAIN INFORMATION" .PP \fBadcli info\fR displays discovered information about an Active Directory domain or an Active Directory domain controller\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli info domain\&.example\&.com \&.\&.\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf $ adcli info \-\-domain\-controller=dc\&.domain\&.example\&.com \&.\&.\&. .fi .if n \{\ .RE .\} .PP \fBadcli info\fR will output as much information as it can about the domain\&. The information is designed to be both machine and human readable\&. The command will exit with a non\-zero exit code if the domain does not exist or cannot be reached\&. .PP To show domain info for a specific domain controller use the \fB\-\-domain\-controller\fR option to specify which domain controller to query\&. .PP Use the \fB\-\-verbose\fR option to show details of how the domain is discovered and queried\&. Many of the global options, in particular authentication options, are not usable with the \fBadcli info\fR command\&. .SH "JOINING THE LOCAL MACHINE TO A DOMAIN" .PP \fBadcli join\fR creates a computer account in the domain for the local machine, and sets up a keytab for the machine\&. It does not configure an authentication service (such as \fBsssd\fR)\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli join domain\&.example\&.com Password for Administrator: .fi .if n \{\ .RE .\} .PP In addition to the global options, you can specify the following options to control how this operation is done\&. .PP \fB\-N, \-\-computer\-name=\fR\fB\fIcomputer\fR\fR .RS 4 The short non\-dotted name of the computer account that will be created in the domain\&. If not specified, then the first portion of the \fB\-\-host\-fqdn\fR is used\&. .RE .PP \fB\-O, \-\-domain\-ou=\fR\fB\fIOU=xxx\fR\fR .RS 4 The full distinguished name of the OU in which to create the computer account\&. If not specified, then the computer account will be created in a default location\&. .RE .PP \fB\-H, \-\-host\-fqdn=\fR\fB\fIhost\fR\fR .RS 4 Override the local machine\*(Aqs fully qualified domain name\&. If not specified, the local machine\*(Aqs hostname will be retrieved via \fBgethostname()\fR\&. If \fBgethostname()\fR only returns a short name \fBgetaddrinfo()\fR with the AI_CANONNAME hint is called to expand the name to a fully qualified domain name\&. .RE .PP \fB\-K, \-\-host\-keytab=\fR\fB\fI/path/to/keytab\fR\fR .RS 4 Specify the path to the host keytab where host credentials will be written after a successful join operation\&. If not specified, the default location will be used, usually /etc/krb5\&.keytab\&. .RE .PP \fB\-\-login\-type=\fR\fB\fI{computer|user}\fR\fR .RS 4 Specify the type of authentication that will be performed before creating the machine account in the domain\&. If set to \*(Aqcomputer\*(Aq, then the computer must already have a preset account in the domain\&. If not specified and none of the other \fB\-\-login\-xxx\fR arguments have been specified, then will try both \*(Aqcomputer\*(Aq and \*(Aquser\*(Aq authentication\&. .RE .PP \fB\-\-os\-name=\fR\fB\fIname\fR\fR .RS 4 Set the operating system name on the computer account\&. The default depends on where adcli was built, but is usually something like \*(Aqlinux\-gnu\*(Aq\&. .RE .PP \fB\-\-os\-service\-pack=\fR\fB\fIpack\fR\fR .RS 4 Set the operating system service pack on the computer account\&. Not set by default\&. .RE .PP \fB\-\-os\-version=\fR\fB\fIversion\fR\fR .RS 4 Set the operating system version on the computer account\&. Not set by default\&. .RE .PP \fB\-\-description=\fR\fB\fIdescription\fR\fR .RS 4 Set the description attribute on the computer account\&. Not set by default\&. .RE .PP \fB\-\-service\-name=\fR\fB\fIservice\fR\fR .RS 4 Additional service name for a Kerberos principal to be created on the computer account\&. This option may be specified multiple times\&. .RE .PP \fB\-\-user\-principal=\fR\fB\fIhost/name@REALM\fR\fR .RS 4 Set the userPrincipalName field of the computer account to this Kerberos principal\&. If you omit the value for this option, then a principal will be set in the form of host/host\&.example\&.com@REALM .RE .PP \fB\-\-one\-time\-password\fR .RS 4 Specify a one time password for a preset computer account\&. This is equivalent to using \fB\-\-login\-type=computer\fR and providing a password as input\&. .RE .PP \fB\-\-trusted\-for\-delegation=\fR\fB\fIyes|no|true|false\fR\fR .RS 4 Set or unset the TRUSTED_FOR_DELEGATION flag in the userAccountControl attribute to allow or not allow that Kerberos tickets can be forwarded to the host\&. .RE .PP \fB\-\-dont\-expire\-password=\fR\fB\fIyes|no|true|false\fR\fR .RS 4 Set or unset the DONT_EXPIRE_PASSWORD flag in the userAccountControl attribute to indicate if the machine account password should expire or not\&. By default adcli will set this flag while joining the domain which corresponds to the default behavior of Windows clients\&. .sp Please note that if the password will expire (\-\-dont\-expire\-password=false) a renewal mechanism has to be enabled on the client to not loose the connectivity to AD if the password expires\&. .RE .PP \fB\-\-add\-service\-principal=\fR\fB\fIservice/hostname\fR\fR .RS 4 Add a service principal name\&. In contrast to the \fB\-\-service\-name\fR the hostname part can be specified as well in case the service should be accessible with a different host name as well\&. .RE .PP \fB\-\-setattr=\fR\fB\fIname=value\fR\fR .RS 4 Add the LDAP attribute \fB\fIname\fR\fR with the given \fB\fIvalue\fR\fR to the new LDAP host object\&. This option can be used multiple times to add multiple different attributes\&. Multi\-value attributes are currently not supported\&. .sp Please note that the account used to join the domain must have the required privileges to add the given attributes\&. Some attributes might have constraints with respect to syntax and allowed values which must be met as well\&. Attributes managed by other adcli options cannot be set with this option\&. .RE .PP \fB\-\-show\-details\fR .RS 4 After a successful join print out information about join operation\&. This is output in a format that should be both human and machine readable\&. .RE .PP \fB\-\-show\-password\fR .RS 4 After a successful join print out the computer machine account password\&. This is output in a format that should be both human and machine readable\&. .RE .PP \fB\-\-add\-samba\-data\fR .RS 4 After a successful join add the domain SID and the machine account password to the Samba specific databases by calling Samba\*(Aqs \fBnet\fR utility\&. .sp Please note that Samba\*(Aqs \fBnet\fR requires some settings in smb\&.conf to create the database entries correctly\&. Most important here is currently the \fBworkgroup\fR option, see \fBsmb.conf\fR(5) for details\&. .RE .PP \fB\-\-samba\-data\-tool=\fR\fB\fI/path/to/net\fR\fR .RS 4 If Samba\*(Aqs \fBnet\fR cannot be found at /usr/bin/net, this option can be used to specific an alternative location with the help of an absolute path\&. .RE .PP \fB\-\-ldap\-passwd\fR .RS 4 Use LDAP add/mod operations to set the machine account password instead of Kerberos\&. This might help in some situations where Kerberos fails or is unreliable\&. But please note that \*(AqChange password\*(Aq or \*(AqReset password\*(Aq permissions or similar might be needed to make the LDAP operation work\&. Additionally there will be no read\-only domain controller (RODC) support as there is with Kerberos\&. .RE .PP If supported on the AD side the \fBmsDS\-supportedEncryptionTypes\fR attribute will be set as well\&. Either the current value or the default list of AD\*(Aqs supported encryption types filtered by the permitted encryption types of the client\*(Aqs Kerberos configuration are written\&. .SH "UPDATING THE MACHINE ACCOUNT PASSWORD AND OTHER ATTRIBUTES" .PP \fBadcli update\fR updates the password of the computer account on the domain controller for the local machine, write the new keys to the keytab and removes older keys\&. It keeps the previous key on purpose because AD will need some time to replicate the new key to all DCs hence the previous key might still be used\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli update .fi .if n \{\ .RE .\} .PP If used with a credential cache, other attributes of the computer account can be changed as well if the principal has sufficient privileges\&. .sp .if n \{\ .RS 4 .\} .nf $ kinit Administrator $ adcli update \-\-login\-ccache=/tmp/krbcc_123 .fi .if n \{\ .RE .\} .PP In addition to the global options, you can specify the following options to control how this operation is done\&. .PP \fB\-N, \-\-computer\-name=\fR\fB\fIcomputer\fR\fR .RS 4 The short non\-dotted name of the computer account that will be created in the domain\&. If not specified, it will be retrieved from the keytab entries\&. .RE .PP \fB\-H, \-\-host\-fqdn=\fR\fB\fIhost\fR\fR .RS 4 The local machine\*(Aqs fully qualified domain name\&. If not specified, the local machine\*(Aqs hostname will be retrieved from the keytab entries\&. .RE .PP \fB\-K, \-\-host\-keytab=\fR\fB\fI/path/to/keytab\fR\fR .RS 4 Specify the path to the host keytab where current host credentials are stored and the new ones will be written to\&. If not specified, the default location will be used, usually /etc/krb5\&.keytab\&. .RE .PP \fB\-\-os\-name=\fR\fB\fIname\fR\fR .RS 4 Set the operating system name on the computer account\&. Not set by default\&. .RE .PP \fB\-\-os\-service\-pack=\fR\fB\fIpack\fR\fR .RS 4 Set the operating system service pack on the computer account\&. Not set by default\&. .RE .PP \fB\-\-os\-version=\fR\fB\fIversion\fR\fR .RS 4 Set the operating system version on the computer account\&. Not set by default\&. .RE .PP \fB\-\-description=\fR\fB\fIdescription\fR\fR .RS 4 Set the description attribute on the computer account\&. Not set by default\&. .RE .PP \fB\-\-service\-name=\fR\fB\fIservice\fR\fR .RS 4 Additional service name for a Kerberos principal to be created on the computer account\&. This option may be specified multiple times\&. .RE .PP \fB\-\-user\-principal=\fR\fB\fIhost/name@REALM\fR\fR .RS 4 Set the userPrincipalName field of the computer account to this Kerberos principal\&. .RE .PP \fB\-\-computer\-password\-lifetime=\fR\fB\fIlifetime\fR\fR .RS 4 Only update the password of the computer account if it is older than the lifetime given in days\&. By default the password is updated if it is older than 30 days\&. .RE .PP \fB\-\-trusted\-for\-delegation=\fR\fB\fIyes|no|true|false\fR\fR .RS 4 Set or unset the TRUSTED_FOR_DELEGATION flag in the userAccountControl attribute to allow or not allow that Kerberos tickets can be forwarded to the host\&. .RE .PP \fB\-\-dont\-expire\-password=\fR\fB\fIyes|no|true|false\fR\fR .RS 4 Set or unset the DONT_EXPIRE_PASSWORD flag in the userAccountControl attribute to indicate if the machine account password should expire or not\&. By default adcli will set this flag while joining the domain which corresponds to the default behavior of Windows clients\&. .sp Please note that if the password will expire (\-\-dont\-expire\-password=false) a renewal mechanism has to be enabled on the client to not loose the connectivity to AD if the password expires\&. .RE .PP \fB\-\-account\-disable=\fR\fB\fIyes|no|true|false\fR\fR .RS 4 Set or unset the ACCOUNTDISABLE flag in the userAccountControl attribute to disable or enable the computer account\&. .RE .PP \fB\-\-add\-service\-principal=\fR\fB\fIservice/hostname\fR\fR .RS 4 Add a service principal name\&. In contrast to the \fB\-\-service\-name\fR the hostname part can be specified as well in case the service should be accessible with a different host name as well\&. .RE .PP \fB\-\-remove\-service\-principal=\fR\fB\fIservice/hostname\fR\fR .RS 4 Remove a service principal name from the keytab and the AD host object\&. .RE .PP \fB\-\-setattr=\fR\fB\fIname=value\fR\fR .RS 4 Add the LDAP attribute \fB\fIname\fR\fR with the given \fB\fIvalue\fR\fR to the LDAP host object\&. This option can be used multiple times to add multiple different attributes\&. Multi\-value attributes are currently not supported\&. .sp Please note that the account used to update the host object must have the required privileges to modify the given attributes\&. Some attributes might have constraints with respect to syntax and allowed values which must be met as well\&. Attributes managed by other adcli options cannot be set with this option\&. .RE .PP \fB\-\-delattr=\fR\fB\fIname\fR\fR .RS 4 Remove the LDAP attribute \fB\fIname\fR\fR from the LDAP host object\&. This option can be used multiple times to remove multiple different attributes\&. .sp Please note that the account used to update the host object must have the required privileges to delete the given attributes\&. Attributes managed by other adcli options cannot be removed\&. .RE .PP \fB\-\-show\-details\fR .RS 4 After a successful join print out information about join operation\&. This is output in a format that should be both human and machine readable\&. .RE .PP \fB\-\-add\-samba\-data\fR .RS 4 After a successful join add the domain SID and the machine account password to the Samba specific databases by calling Samba\*(Aqs \fBnet\fR utility\&. .sp Please note that Samba\*(Aqs \fBnet\fR requires some settings in smb\&.conf to create the database entries correctly\&. Most important here is currently the \fBworkgroup\fR option, see \fBsmb.conf\fR(5) for details\&. .sp Note that if the machine account password is not older than 30 days, you have to pass \fB\-\-computer\-password\-lifetime=0\fR to force the update\&. .RE .PP \fB\-\-samba\-data\-tool=\fR\fB\fI/path/to/net\fR\fR .RS 4 If Samba\*(Aqs \fBnet\fR cannot be found at /usr/bin/net, this option can be used to specific an alternative location with the help of an absolute path\&. .RE .PP \fB\-\-ldap\-passwd\fR .RS 4 Use LDAP add/mod operations to set the machine account password instead of Kerberos\&. This might help in some situations where Kerberos fails or is unreliable\&. But please note that \*(AqChange password\*(Aq or \*(AqRest password\*(Aq permissions or similar might be needed to make the LDAP operation work\&. Additionally there will be no read\-only domain controller (RODC) support as there is with Kerberos\&. .RE .PP If supported on the AD side the \fBmsDS\-supportedEncryptionTypes\fR attribute will be set as well\&. Either the current value or the default list of AD\*(Aqs supported encryption types filtered by the permitted encryption types of the client\*(Aqs Kerberos configuration are written\&. .SH "TESTING IF THE MACHINE ACCOUNT PASSWORD IS VALID" .PP \fBadcli testjoin\fR uses the current credentials in the keytab and tries to authenticate with the machine account to the AD domain\&. If this works the machine account password and the join are still valid\&. If it fails the machine account password or the whole machine account have to be refreshed with \fBadcli join\fR or \fBadcli update\fR\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli testjoin .fi .if n \{\ .RE .\} .PP Only the global options not related to authentication are available, additionally you can specify the following options to control how this operation is done\&. .PP \fB\-K, \-\-host\-keytab=\fR\fB\fI/path/to/keytab\fR\fR .RS 4 Specify the path to the host keytab where current host credentials are stored and the new ones will be written to\&. If not specified, the default location will be used, usually /etc/krb5\&.keytab\&. .RE .SH "CREATING A USER" .PP \fBadcli create\-user\fR creates a new user account in the domain\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli create\-user Fry \-\-domain=domain\&.example\&.com \e \-\-display\-name="Philip J\&. Fry" \-\-mail=fry@domain\&.example\&.com .fi .if n \{\ .RE .\} .PP In addition to the global options, you can specify the following options to control how the user is created\&. .PP \fB\-\-display\-name=\fR\fB\fI"Name"\fR\fR .RS 4 Set the displayName attribute of the new created user account\&. .RE .PP \fB\-O, \-\-domain\-ou=\fR\fB\fIOU=xxx\fR\fR .RS 4 The full distinguished name of the OU in which to create the user account\&. If not specified, then the computer account will be created in a default location\&. .RE .PP \fB\-\-mail=\fR\fB\fIemail@domain\&.com\fR\fR .RS 4 Set the mail attribute of the new created user account\&. This attribute may be specified multiple times\&. .RE .PP \fB\-\-unix\-home=\fR\fB\fI/home/user\fR\fR .RS 4 Set the unixHomeDirectory attribute of the new created user account, which should be an absolute path to the user\*(Aqs home directory\&. .RE .PP \fB\-\-unix\-gid=\fR\fB\fI111\fR\fR .RS 4 Set the gidNumber attribute of the new created user account, which should be the user\*(Aqs numeric primary group id\&. .RE .PP \fB\-\-unix\-shell=\fR\fB\fI/bin/shell\fR\fR .RS 4 Set the loginShell attribute of the new created user account, which should be a path to a valid shell\&. .RE .PP \fB\-\-unix\-uid=\fR\fB\fI111\fR\fR .RS 4 Set the uidNumber attribute of the new created user account, which should be the user\*(Aqs numeric primary user id\&. .RE .PP \fB\-\-nis\-domain=\fR\fB\fInis_domain\fR\fR .RS 4 Set the msSFU30NisDomain attribute of the new created user account, which should be the user\*(Aqs NIS domain is the NIS/YP service of Active Directory\*(Aqs Services for Unix (SFU) are used\&. This is needed to let the \*(AqUNIX attributes\*(Aq tab of older Active Directory versions show the set UNIX specific attributes\&. If not specified adcli will try to determine the NIS domain automatically if needed\&. .RE .SH "DELETING A USER" .PP \fBadcli delete\-user\fR deletes a user account from the domain\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli delete\-user Fry \-\-domain=domain\&.example\&.com .fi .if n \{\ .RE .\} .PP The various global options can be used\&. .SH "(RE)SETTING THE PASSWORD OF A USER WITH AN ADMINISTRATIVE ACCOUNT" .PP \fBadcli passwd\-user\fR sets or resets the password of user account\&. The administrative account used for this operation must have privileges to set a password\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli passwd\-user Fry \-\-domain=domain\&.example\&.com .fi .if n \{\ .RE .\} .PP The various global options can be used\&. .SH "CREATING A GROUP" .PP \fBadcli create\-group\fR creates a new group in the domain\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli create\-group Pilots \-\-domain=domain\&.example\&.com \e \-\-description="Group for all pilots" .fi .if n \{\ .RE .\} .PP In addition to the global options, you can specify the following options to control how the group is created\&. .PP \fB\-\-description=\fR\fB\fI"text"\fR\fR .RS 4 Set the description attribute of the new created group\&. .RE .PP \fB\-O, \-\-domain\-ou=\fR\fB\fIOU=xxx\fR\fR .RS 4 The full distinguished name of the OU in which to create the group\&. If not specified, then the group will be created in a default location\&. .RE .SH "DELETING A GROUP" .PP \fBadcli delete\-group\fR deletes a group from the domain\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli delete\-group Pilots \-\-domain=domain\&.example\&.com .fi .if n \{\ .RE .\} .PP The various global options can be used\&. .SH "ADDING A MEMBER TO A GROUP" .PP \fBadcli add\-member\fR adds one or more users to a group in the domain\&. The group is specified first, and then the various users or computers to be added\&. You must use dollar sign for computer account (computername$) .sp .if n \{\ .RS 4 .\} .nf $ adcli add\-member \-\-domain=domain\&.example\&.com Pilots Leela Scruffy $ adcli add\-member \-\-domain=domain\&.example\&.com servers srv\-smb$ .fi .if n \{\ .RE .\} .PP The various global options can be used\&. .PP .SH "REMOVING A MEMBER FROM A GROUP" .PP \fBadcli remove\-member\fR removes a user from a group in the domain\&. The group is specified first, and then the various users to be removed\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli remove\-member \-\-domain=domain\&.example\&.com Pilots Scruffy .fi .if n \{\ .RE .\} .PP The various global options can be used\&. .SH "PRESET COMPUTER ACCOUNTS" .PP \fBadcli preset\-computer\fR pre\-creates one or more computer accounts in the domain for machines to later use when joining the domain\&. By doing this machines can join using a one time password or automatically without a password\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli preset\-computer \-\-domain=domain\&.example\&.com \e host1\&.example\&.com host2 Password for Administrator: .fi .if n \{\ .RE .\} .PP If the computer names specified contain dots, then they are treated as fully qualified host names, otherwise they are treated as short computer names\&. The computer accounts must not already exist\&. .PP In addition to the global options, you can specify the following options to control how this operation is done\&. .PP \fB\-O, \-\-domain\-ou=\fR\fB\fIOU=xxx\fR\fR .RS 4 The full distinguished name of the OU in which to create the computer accounts\&. If not specified, then the computer account will be created in a default location\&. .RE .PP \fB\-\-one\-time\-password\fR .RS 4 Specify a one time password to use when presetting the computer accounts\&. If not specified, then a default password will be used, which allows for later automatic joins\&. .RE .PP \fB\-\-os\-name=\fR\fB\fIname\fR\fR .RS 4 Set the operating system name on the computer account\&. The default depends on where adcli was built, but is usually something like \*(Aqlinux\-gnu\*(Aq\&. .RE .PP \fB\-\-os\-service\-pack=\fR\fB\fIpack\fR\fR .RS 4 Set the operating system service pack on the computer account\&. Not set by default\&. .RE .PP \fB\-\-os\-version=\fR\fB\fIversion\fR\fR .RS 4 Set the operating system version on the computer account\&. Not set by default\&. .RE .PP \fB\-\-service\-name=\fR\fB\fIservice\fR\fR .RS 4 Additional service name for a Kerberos principal to be created on the computer account\&. This option may be specified multiple times\&. .RE .PP \fB\-\-user\-principal\fR .RS 4 Set the userPrincipalName field of the computer account to this Kerberos principal in the form of host/host\&.example\&.com@REALM .RE .SH "RESET COMPUTER ACCOUNT" .PP \fBadcli reset\-computer\fR resets a computer account in the domain\&. If the appropriate machine is currently joined to the domain, then its membership will be broken\&. The account must already exist\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli reset\-computer \-\-domain=domain\&.example\&.com host2 .fi .if n \{\ .RE .\} .PP If the computer names specified contain dots, then they are treated as fully qualified host names, otherwise they are treated as short computer names\&. .PP In addition to the global options, you can specify the following options to control how this operation is done\&. .PP \fB\-\-login\-type=\fR\fB\fI{computer|user}\fR\fR .RS 4 Specify the type of authentication that will be performed before creating the machine account in the domain\&. If set to \*(Aqcomputer\*(Aq, then the computer must already have a preset account in the domain\&. If not specified and none of the other \fB\-\-login\-xxx\fR arguments have been specified, then will try both \*(Aqcomputer\*(Aq and \*(Aquser\*(Aq authentication\&. .RE .SH "DELETE COMPUTER ACCOUNT" .PP \fBadcli delete\-computer\fR deletes a computer account in the domain\&. The account must already exist\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli delete\-computer \-\-domain=domain\&.example\&.com host2 Password for Administrator: .fi .if n \{\ .RE .\} .PP If the computer name contains a dot, then it is treated as fully qualified host name, otherwise it is treated as short computer name\&. .PP If no computer name is specified, then the host name of the computer adcli is running on is used, as returned by gethostname()\&. .PP The various global options can be used\&. .SH "SHOW COMPUTER ACCOUNT ATTRIBUTES" .PP \fBadcli show\-computer\fR show the computer account attributes stored in AD\&. The account must already exist\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli show\-computer \-\-domain=domain\&.example\&.com host2 Password for Administrator: .fi .if n \{\ .RE .\} .PP If the computer name contains a dot, then it is treated as fully qualified host name, otherwise it is treated as short computer name\&. .PP If no computer name is specified, then the host name of the computer adcli is running on is used, as returned by gethostname()\&. .PP The various global options can be used\&. .SH "CREATE A MANAGED SERVICE ACCOUNT" .PP \fBadcli create\-msa\fR creates a managed service account (MSA) in the given Active Directory domain\&. This is useful if a computer should not fully join the Active Directory domain but LDAP access is needed\&. A typical use case is that the computer is already joined an Active Directory domain and needs access to another Active Directory domain in the same or a trusted forest where the host credentials from the joined Active Directory domain are not valid, e\&.g\&. there is only a one\-way trust\&. .sp .if n \{\ .RS 4 .\} .nf $ adcli create\-msa \-\-domain=domain\&.example\&.com Password for Administrator: .fi .if n \{\ .RE .\} .PP The managed service account, as maintained by adcli, cannot have additional service principals names (SPNs) associated with it\&. An SPN is defined within the context of a Kerberos service which is tied to a machine account in Active Directory\&. Since a machine can be joined to a single Active Directory domain, managed service account in a different Active Directory domain will not have the SPNs that otherwise are part of another Active Directory domain\*(Aqs machine\&. .PP Since it is expected that a client will most probably join to the Active Directory domain matching its DNS domain the managed service account will be needed for a different Active Directory domain and as a result the Active Directory domain name is a mandatory option\&. If called with no other options \fBadcli create\-msa\fR will use the short hostname with an additional random suffix as computer name to avoid name collisions\&. .PP LDAP attribute sAMAccountName has a limit of 20 characters\&. However, machine account\*(Aqs NetBIOS name must be at most 16 characters long, including a trailing \*(Aq$\*(Aq sign\&. Since it is not expected that the managed service accounts created by adcli will be used on the NetBIOS level the remaining 4 characters can be used to add uniqueness\&. Managed service account names will have a suffix of 3 random characters from number and upper\- and lowercase ASCII ranges appended to the chosen short host name, using \*(Aq!\*(Aq as a separator\&. For a host with the shortname \*(Aqmyhost\*(Aq, a managed service account will have a common name (CN attribute) \*(Aqmyhost!A2c\*(Aq and a NetBIOS name (sAMAccountName attribute) will be \*(Aqmyhost!A2c$\*(Aq\&. A corresponding Kerberos principal in the Active Directory domain where the managed service account was created would be \*(Aqmyhost!A2c$@DOMAIN\&.EXAMPLE\&.COM\*(Aq\&. .PP A keytab for the managed service account is stored into a file specified with \-K option\&. If it is not specified, the file is named after the default keytab file, with lowercase Active Directory domain of the managed service account as a suffix\&. On most systems it would be /etc/krb5\&.keytab with a suffix of \*(Aqdomain\&.example\&.com\*(Aq, e\&.g\&. /etc/krb5\&.keytab\&.domain\&.example\&.com\&. .PP \fBadcli create\-msa\fR can be called multiple times to reset the password of the managed service account\&. To identify the right account with the random component in the name the corresponding principal is read from the keytab\&. If the keytab got deleted \fBadcli\fR will try to identify an existing managed service account with the help of the fully\-qualified name, if this fails a new managed service account will be created\&. .PP The managed service account password can be updated with .sp .if n \{\ .RS 4 .\} .nf $ adcli update \-\-domain=domain\&.example\&.com \-\-host\-keytab=/etc/krb5\&.keytab\&.domain\&.example\&.com .fi .if n \{\ .RE .\} .sp and the managed service account can be deleted with .sp .if n \{\ .RS 4 .\} .nf $ adcli delete\-computer \-\-domain=domain\&.example\&.com \*(Aqmyhost!A2c\*(Aq .fi .if n \{\ .RE .\} .PP In addition to the global options, you can specify the following options to control how this operation is done\&. .PP \fB\-N, \-\-computer\-name=\fR\fB\fIcomputer\fR\fR .RS 4 The short non\-dotted name of the managed service account that will be created in the Active Directory domain\&. The long option name \fB\-\-computer\-name\fR is kept to underline the similarity with the same option of the other sub\-commands\&. If not specified, then the first portion of the \fB\-\-host\-fqdn\fR or its default is used with a random suffix\&. .RE .PP \fB\-O, \-\-domain\-ou=\fR\fB\fIOU=xxx\fR\fR .RS 4 The full distinguished name of the OU in which to create the managed service account\&. If not specified, then the managed service account will be created in a default location\&. .RE .PP \fB\-H, \-\-host\-fqdn=\fR\fB\fIhost\fR\fR .RS 4 Override the local machine\*(Aqs fully qualified DNS domain name\&. If not specified, the local machine\*(Aqs hostname will be retrieved via \fBgethostname()\fR\&. If \fBgethostname()\fR only returns a short name \fBgetaddrinfo()\fR with the AI_CANONNAME hint is called to expand the name to a fully qualified DNS domain name\&. .RE .PP \fB\-K, \-\-host\-keytab=\fR\fB\fI/path/to/keytab\fR\fR .RS 4 Specify the path to the host keytab where credentials of the managed service account will be written after a successful creation\&. If not specified, the default location will be used, usually /etc/krb5\&.keytab with the lower\-cased Active Directory domain name added as a suffix e\&.g\&. /etc/krb5\&.keytab\&.domain\&.example\&.com\&. .RE .PP \fB\-\-show\-details\fR .RS 4 After a successful creation print out information about the created object\&. This is output in a format that should be both human and machine readable\&. .RE .PP \fB\-\-show\-password\fR .RS 4 After a successful creation print out the managed service account password\&. This is output in a format that should be both human and machine readable\&. .RE .SH "DELEGATED PERMISSIONS" .PP It is common practice in AD to not use an account from the Domain Administrators group to join a machine to a domain but use a dedicated account which only has permissions to join a machine to one or more OUs in the Active Directory tree\&. Giving the needed permissions to a single account or a group in Active Directory is called Delegation\&. A typical example on how to configured Delegation can be found in the Delegation section of the blog post \m[blue]\fBWho can add workstation to the domain\fR\m[]\&\s-2\u[1]\d\s+2\&. .PP When using an account with delegated permissions with adcli basically the same applies as well\&. However some aspects are explained here in a bit more details to better illustrate different concepts of Active Directory and to make it more easy to debug permissions issues during the join\&. Please note that the following is not specific to adcli but applies to all applications which would like to modify certain properties or objects in Active Directory with an account with limited permissions\&. .PP First, as said in the blog post it is sufficient to have "Create computer object" permissions to join a computer to a domain\&. But this would only work as expected if the computer object does not exist in Active Directory before the join\&. Because only when a new object is created Active Directory does not apply additional permission checks on the attributes of the new computer object\&. This means the delegated user can add any kind of attribute with any value to a new computer object also long as they meet general constraints like e\&.g\&. that the attribute must be defined in the schema and is allowed in a objectclass of the object, the value must match the syntax defined in the schema or that the \fBsAMAccountName\fR must be unique in the domain\&. .PP If you want to use the account with delegated permission to remove computer objects in Active Directory (adcli delete\-computer) you should of course make sure that the account has "Delete computer object" permissions\&. .PP If the computer object already exists the "Create computer object" permission does not apply anymore since now an existing object must be modified\&. Now permissions on the individual attributes are needed\&. e\&.g\&. "Read and write Account Restrictions" or "Reset Password"\&. For some attributes Active Directory has two types of permissions the plain "Read and Write" permissions and the "Validated Write" permissions\&. For the latter case there are two specific permissions relevant for adcli, namely .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Validated write to DNS host name .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Validated write to service principal name .RE .sp Details about the validation of the values can be found in the "Validated Writes" section of [MS\-ADTS], especially \m[blue]\fBdNSHostName\fR\m[]\&\s-2\u[2]\d\s+2 and \m[blue]\fBservicePrincipalName\fR\m[]\&\s-2\u[3]\d\s+2\&. To cut it short for "Validated write to DNS host name" the domain part of the fully\-qualified hostname must either match the domain name of the domain you want to join to or must be listed in the \fBmsDS\-AllowedDNSSuffixes\fR attribute\&. And for "Validated write to service principal name" the hostname part of the service principal name must match the name stored in \fBdNSHostName\fR or some other attributes which are not handled by adcli\&. This also means that \fBdNSHostName\fR cannot be empty or only contain a short name if the service principal name should contain a fully\-qualified name\&. .PP To summarize, if you only have validated write permissions you should make sure the domain part of the hostname matches the domain you want to join or use the \fB\-\-host\-fqdn\fR with a matching name\&. .PP The plain read write permissions do not run additional validations but the attribute values must still be in agreement with the general constraints mentioned above\&. If the computer object already exists adcli might need the following permissions which are also needed by Windows clients to modify existing attributes: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Reset Password .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read and write Account Restrictions .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read and (validated) write to DNS host name .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read and (validated) write to service principal name .RE .sp additionally adcli needs .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read and write msDS\-supportedEncryptionTypes .RE .sp This is added for security reasons to avoid that Active Directory stores Kerberos keys with (potentially weaker) encryption types than the client supports since Active Directory is often configured to still support older (weaker) encryption types for compatibility reasons\&. .PP All other attributes are only set or modified on demand, i\&.e\&. adcli must be called with an option the would set or modify the given attribute\&. In the following the attributes adcli can modify together with the required permissions are listed: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} userPrincipalName .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read/Write userPrincipal Name .RE .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} msDS\-supportedEncryptionTypes .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read/Write msDS\-SupportedEncryptionTypes .RE .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} dNSHostName .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read/Write dNSHostName .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read and write DNS host name attributes .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Validated write to DNS host name .RE .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} servicePrincipalName .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read/Write servicePrincipalName .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Validated write to service principal name .RE .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} operatingSystem .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read/Write Operating System .RE .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} operatingSystemVersion .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read/Write Operating System Version .RE .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} operatingSystemServicePack .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read/Write operatingSystemServicePack .RE .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} userAccountControl .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read/Write userAccountControl .RE .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} description .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Read/Write Description .RE .RE .PP For the management of users and groups (adcli create\-user, adcli delete\-user, adcli create\-group, adcli delete\-group) the same applies only for different types of objects, i\&.e\&. users and groups\&. Since currently adcli only supports the creation and the removal of user and group objects it is sufficient to have the "Create/Delete User objects" and "Create/Delete Group objects" permissions\&. .PP If you want to manage group members as well (adcli add\-member, adcli remove\-member) "Read/Write Members" permissions are needed as well\&. .PP Depending on the version of Active Directory the "Delegation of Control Wizard" might offer some shortcuts for common task like e\&.g\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Create, delete and manage user accounts .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Create, delete and manage groups .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Modify the membership of a group .RE .sp The first 2 shortcuts will provided full access to user and group objects which, as explained above, is more than currently is needed\&. After using those shortcut it is a good idea to verify in the "Security" tab in the "Properties" of the related Active Directory container that the assigned permissions meet the expectations\&. .SH "BUGS" .PP Please send bug reports to either the distribution bug tracker or the upstream bug tracker at \m[blue]\fBhttps://bugs\&.freedesktop\&.org/enter_bug\&.cgi?product=realmd&component=adcli\fR\m[] .SH "SEE ALSO" \fBrealmd\fR(8), \fBnet\fR(8), \fBsssd\fR(8) .PP Further details available in the realmd online documentation at \m[blue]\fBhttp://www\&.freedesktop\&.org/software/realmd/\fR\m[] .SH "NOTES" .IP " 1." 4 Who can add workstation to the domain .RS 4 \%https://docs.microsoft.com/en-us/archive/blogs/dubaisec/who-can-add-workstation-to-the-domain .RE .IP " 2." 4 dNSHostName .RS 4 \%https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/5c578b15-d619-408d-ba17-380714b89fd1 .RE .IP " 3." 4 servicePrincipalName .RS 4 \%https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/28ca4eca-0e0b-4666-9175-a37ccb8edada .RE