以前に CentOS7 へ Samba4 をインストールし、AD 環境を構築するというメモを書きました。 今回は AmazonLinux2 へ Samba4.10.5 を ActiveDirectory のドメインコントローラとしてインストールする手順をメモします。
目次
環境
今回は最終的に以下の環境を構築します。 現時点で AmazonLinux2 標準の Python はバージョン 2.7.x 系でした。
尚、AmazonLinux2 はインストール直後の初期状態で Amazon の NTP サーバ (169.254.169.123) と同期しています。 時刻同期の状態は chronyc sources
で確認出来ます。
# chronyc sources 210 Number of sources = 5 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 169.254.169.123 3 4 377 23 +1972ns[+2927ns] +/- 657us ^- tock.usshc.com 1 10 377 110 +12ms[ +12ms] +/- 78ms ^- hadb1.smatwebdesign.com 2 10 377 328 +1551us[+1551us] +/- 120ms ^- 44.190.6.254 2 10 377 985 -90us[ -94us] +/- 85ms ^- clock.thinkpad.io 2 10 377 345 +2301us[+2301us] +/- 124ms
Samba のインストール
Samba をインストールしていきます。
必要パッケージをインストールする
Samba をインストールする事前準備として、前提となるパッケージをインストールします。 EPEL (Extra Packages for Enterprise Linux) からパッケージをインストールすることになりますが、AmazonLinux2 なので amazon-linux-extras
を使って EPEL リポジトリをインストールします。
yes | amazon-linux-extras install epel
必要なパッケージをインストールします。
yum -y install \ attr \ bind-utils \ docbook-style-xsl \ gcc \ gdb \ gnutls-devel \ gpgme-devel \ jansson-devel \ keyutils-libs-devel \ krb5-workstation \ libacl-devel \ libaio-devel \ libarchive-devel \ libattr-devel \ libblkid-devel \ libsemanage-python \ libxml2-devel \ libxslt \ lmdb-devel \ openldap-devel \ pam-devel \ perl \ perl-ExtUtils-MakeMaker \ perl-Parse-Yapp \ perl-Test-Base \ pkgconfig \ policycoreutils-python \ popt-devel \ python-crypto \ python-devel \ python-gpgme \ readline-devel \ systemd-devel \ zlib-devel
Samba をソースコードからインストールする
現時点ではリポジトリからインストール出来るのは 4.8.3 とバージョンがやや古く、しかも Samba をドメインコントローラとして構築する際には多用することになる samba-tool
がなぜかインストールされません。 この件についてはネット上でも How to install samba-tool on Amazon Linux と質問されている方がおり、現時点では回答されていません。 その為、今回はソースコードから Samba をインストールしていきます。 AmazonLinux2 標準の Python はバージョン 2.7.x 系である為、Python2 系である前提で作業していきます。
mkdir -p /usr/local/src/samba/ cd /usr/local/src/samba/ wget https://download.samba.org/pub/samba/samba-latest.tar.gz tar zxvf samba-latest.tar.gz cd samba-4.10.5/ PYTHON=python2 ./configure PYTHON=python2 make PYTHON=python2 make install
Samba のセットアップ
Samba のインストールが完了したら環境を整え、ドメインを構築していきます。
Samba へのパスを追加する
ソースコードから Samba をインストールした場合、パスを指定しない限り実行ファイルは /usr/local/samba/bin
配下にインストールされます。 標準でここにはパスが通っていない為、利便性を考えてパスを通しておきます。 今回は root ユーザで操作することだけを想定し、/root/.bash_profile
にパスを追加しました。
echo "export PATH=\"/usr/local/samba/bin:/usr/local/samba/sbin:${PATH}\"" >> ~/.bash_profile
ドメインを構築する
次はドメインを構築していきます。 対話的にドメインを構築する場合は以下のように実行します。
samba-tool domain provision --use-rfc2307 --interactive
ある程度、パラメータを指定して非対話的に構築する場合は以下のように実行します。 非対話式の実行オプションを見る限り、DNS Forwarder の指定が見当たらないようですが、実際に非対話で実行した後で生成される設定ファイルを確認すると、「予め /etc/resolv.conf
に設定されていた DNS サーバ」を DNS Forwarder として設定されていました。
samba-tool domain provision \ --use-rfc2307 \ --realm=EXAMPLE.COM \ --server-role=dc \ --dns-backend=SAMBA_INTERNAL \ --domain=EXAMPLE \ --adminpass="PASSWORD"
ドメインを構築すると設定ファイルは /usr/local/samba/etc/smb.conf
に生成されます。 例えば以下のような内容になっているはずです。
# Global parameters [global] dns forwarder = 192.168.1.2 netbios name = AD realm = EXAMPLE.COM server role = active directory domain controller workgroup = EXAMPLE idmap_ldb:use rfc2307 = yes [netlogon] path = /usr/local/samba/var/locks/sysvol/example.com/scripts read only = No [sysvol] path = /usr/local/samba/var/locks/sysvol read only = No
LDAPS を強制しない
初期状態では LDAPS を強制する設定になっているようです。 セキュリティ上はこの方が好ましいですが、検証上の理由から LDAPS を強制しない設定へ変更するには smb.conf
の [global]
セクションへ以下を追加します。
client ldap sasl wrapping = sign ldap server require strong auth = no
/usr/local/samba/etc/smb.conf
全体例は以下の通りです。
# Global parameters [global] dns forwarder = 192.168.1.2 netbios name = AD realm = EXAMPLE.COM server role = active directory domain controller workgroup = EXAMPLE idmap_ldb:use rfc2307 = yes client ldap sasl wrapping = sign ldap server require strong auth = no [netlogon] path = /usr/local/samba/var/locks/sysvol/example.com/scripts read only = No [sysvol] path = /usr/local/samba/var/locks/sysvol read only = No
起動&自動起動の設定
今回はパッケージマネージャでは無く、ソースコードから Samba をインストールした為、systemd 用のスクリプトがありません。 その為、以下の内容で systemd 用のスクリプトを新規作成しておきます。
cat << EOF > /etc/systemd/system/samba.service [Unit] Description= Samba 4 Active Directory After=syslog.target After=network.target [Service] Type=forking PIDFile=/usr/local/samba/var/run/samba.pid ExecStart=/usr/local/samba/sbin/samba [Install] WantedBy=multi-user.target EOF
これで systemctl
コマンドを通じての起動や自動起動が行えるようになりました。 ファイルを追加したので daemon-reload
した後、Samba を起動&自動起動するようにしておきます。
systemctl daemon-reload systemctl enable samba systemctl start samba
システムボリュームの確認
ドメインコントローラとして構築したので、netlogon
や sysvol
といったシステムボリュームが表示されることを確認しておきます。
$ smbclient -L localhost -U% Sharename Type Comment --------- ---- ------- netlogon Disk sysvol Disk IPC$ IPC IPC Service (Samba 4.10.5) Reconnecting with SMB1 for workgroup listing. Server Comment --------- ------- Workgroup Master --------- -------
DNS 設定の変更
DNS の設定は以下のように変更していきます。
- AmazonLinux2 自身が参照する DNS サーバを自分自身 (127.0.0.1) にする
- SAMBA_INTERNAL な DNS サービスの DNS Forwarder は Amazon 提供の DNS サーバにする
初期状態のままでは DNS の設定を変更しても OS を再起動する度… というより、正確には DHCP Client が実行される度、DHCP サーバから受信した DNS サーバ設定を上書きしてしまいます。 これを避ける為、DHCP の設定を変更し、DNS 関連のパラメータは受信しない (上書きしない) ようにします。 具体的には /etc/sysconfig/network-scripts/ifcfg-eth0
のうち、PEERDNS=yes
を no
へ変更します。
DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes TYPE=Ethernet USERCTL=yes PEERDNS=no DHCPV6C=yes DHCPV6C_OPTIONS=-nw PERSISTENT_DHCLIENT=yes RES_OPTIONS="timeout:2 attempts:5" DHCP_ARP_CHECK=no
これで DNS 関連の設定は上書きされなくなりました。 続いて OS が参照する DNS サーバのアドレスを変更します。 対象の設定ファイルは /etc/resolv.conf
です。 変更前は以下のようになっているはずです。
options timeout:2 attempts:5 ; generated by /usr/sbin/dhclient-script search ap-northeast-1.compute.internal example.com nameserver 192.168.1.2
これを以下のように nameserver
を書き換えます。
options timeout:2 attempts:5 ; generated by /usr/sbin/dhclient-script search ap-northeast-1.compute.internal example.com nameserver 127.0.0.1
設定ファイルの修正が完了したら network
サービスを再起動し、設定変更を反映します。
systemctl restart network
ユーザの確認
登録されているユーザは samba-tool user list
で一覧表示することが出来ます。
$ samba-tool user list Guest krbtgt Administrator
FSMO の確認
今回は Samba が一台だけのシングル構成である為、FSMO (Flexible Single Master Operation) = 操作マスタは自分自身になっているはずです。 操作マスタの各役割をどのサーバが担っているか?は samba-tool fsmo show
で確認することが出来ます。
samba-tool fsmo show
レプリケーションの確認
今回は Samba が一台だけのシングル構成なので、あまり確認する意味がありませんが、複数のドメインコントローラ間でレプリケーションを実施する構成にしている場合は samba-tool drs showrepl
でレプリケーションの状態を確認することが出来ます。
samba-tool drs showrepl
ドメイン機能レベルの確認
現在、設定されているドメイン機能レベルは samba-tool domain level show
で確認することが出来ます。
# samba-tool domain level show Domain and forest function level for domain 'DC=example,DC=com' Forest function level: (Windows) 2008 R2 Domain function level: (Windows) 2008 R2 Lowest function level of a DC: (Windows) 2008 R2
Samba におけるドメインレベルの実装状況は Raising the Functional Levels に記載されています。 一部、抜粋します。
機能レベル | Samba のバージョン |
---|---|
2012_R2 | 4.4 以降 |
2012 | 4.4 以降 |
2008_R2 | 4.0 以降 |
2008 | 4.0 以降 |
2003 | 4.0 以降 |
但し、下記の記載がある為、ドメイン機能レベルは 2008_R2
を指定するのが無難に思います。
Functional level is included for use against Windows, but not supported in Samba. Kerberos improvements from Windows Server 2012 and 2012 R2 are not implemented in Samba.
Kerberos 認証の設定
クライアントが ActiveDirectory へ認証要求を行う際は Kerberos による認証が行われます。 ここでは Kerberos の設定を行います。 /etc/krb5.conf
を以下の内容へ変更します。
[libdefaults] default_realm = EXAMPLE.COM dns_lookup_realm = false dns_lookup_kdc = true
ここで Kerberos 認証の動作テストを実施しておきます。 まず初めに kinit
で認証情報がキャッシュされていないことを確認しておきます。
# klist klist: No credentials cache found (filename: /tmp/krb5cc_0)
ドメインに対して kerberos で認証要求を行います。 今回は administrator ユーザを使いました。 ドメイン名は小文字で指定するとエラーになる為、大文字で指定します。 パスワードを要求されたら Kerberos 認証を要求したユーザのパスワードを入力します。
kinit administrator@EXAMPLE.COM
Kerberos 認証に成功した場合、再度 kinit
で認証情報を確認すると、今度は認証情報がキャッシュされていることが分かります。
# klist Ticket cache: FILE:/tmp/krb5cc_0 Default principal: administrator@EXAMPLE.COM Valid starting Expires Service principal 07/06/2019 11:47:46 07/06/2019 21:47:46 krbtgt/EXAMPLE.COM@EXAMPLE.COM renew until 07/07/2019 11:47:29
尚、キャッシュされた TGT を削除したい場合は kdestroy
を実行します。
kdestroy
OU / ユーザ / グループのセットアップ
ドメインのセットアップが完了したら OU やユーザ、グループを作成していきます。 ほぼ全ての作業を samba-tool
で実施していきます。
OU の作成
以前は samba-tool
を使って OU を作成することが出来なかったようですが、現在では作成可能になっています。 People
や Groups
といった OU を作成する例は以下の通りです。
samba-tool ou create 'OU=People,DC=example,DC=com' samba-tool ou create 'OU=Groups,DC=example,DC=com'
ユーザの作成
以前は samba-tool user add
でユーザを追加しましたが、現在は add
では無く、samba-tool user create
でユーザを作成することが推奨されています。 最も基本的な構文は以下の通りです。 この場合、CN=Users
上にユーザが作成されます。
samba-tool user create [USERNAME] [PASSWORD]
指定した OU 上にユーザを作成するには以下のように実行します。 これは People
という OU 上にユーザを作成する例です。
samba-tool user create [USERNAME] [PASSWORD] --userou='OU=People'
グループの作成
グループを作成する最も基本的な構文は以下の通りです。 この場合、CN=Users
上にユーザが作成されます。
samba-tool group add [GROUP]
指定した OU 上にグループを作成するには以下のように実行します。 これは Groups
という OU 上にグループを作成する例です。
samba-tool group add [GROUP] --groupou='OU=Groups'
メンバーをグループに追加する
ユーザをグループに追加する、最も基本的な構文は以下の通りです。
samba-tool group addmembers [GROUP] [USERNAME]
よく使うコマンドチートシート
コマンド名 | 説明 |
---|---|
samba-tool user show [USER] |
ユーザの設定を表示する |
samba-tool user add [USER] |
ユーザを追加する (CN=Users へ追加) |
samba-tool user add [USER] --userou=[OU] |
OU へユーザを追加する |
samba-tool user add [USER] --description=[DESCRIPTION] |
説明文を付与し、ユーザを追加する |
samba-tool user delete [USER] |
ユーザを削除する |
samba-tool user enable [USER] |
ユーザを有効化する |
samba-tool user disable [USER] |
ユーザを無効化する |
samba-tool user move [USER] [CN/OU] |
ユーザを指定したコンテナ/OU へ移動する |
samba-tool group add [GROUP] |
グループを追加する (CN=Users へ追加) |
samba-tool group add [GROUP] --groupou=ou=[OU] |
OU へグループを追加する |
samba-tool group addmembers [GROUP] [USER] |
グループにユーザを追加する |
samba-tool user setpassword [USER] --newpassword=[PASSWORD] |
ユーザのパスワードを変更する |
samba-tool user setexpiry [USER] --noexpiry |
ユーザのパスワードを無期限にする |
ヘルプ
samba-tool domain provision
$ samba-tool domain provision --help Usage: samba-tool domain provision [options] Provision a domain. Options: -h, --help show this help message and exit --interactive Ask for names --domain=DOMAIN NetBIOS domain name to use --domain-guid=GUID set domainguid (otherwise random) --domain-sid=SID set domainsid (otherwise random) --ntds-guid=GUID set NTDS object GUID (otherwise random) --invocationid=GUID set invocationid (otherwise random) --host-name=HOSTNAME set hostname --host-ip=IPADDRESS set IPv4 ipaddress --host-ip6=IP6ADDRESS set IPv6 ipaddress --site=SITENAME set site name --adminpass=PASSWORD choose admin password (otherwise random) --krbtgtpass=PASSWORD choose krbtgt password (otherwise random) --dns-backend=NAMESERVER-BACKEND The DNS server backend. SAMBA_INTERNAL is the builtin name server (default), BIND9_FLATFILE uses bind9 text database to store zone information, BIND9_DLZ uses samba4 AD to store zone information, NONE skips the DNS setup entirely (not recommended) --dnspass=PASSWORD choose dns password (otherwise random) --root=USERNAME choose 'root' unix username --nobody=USERNAME choose 'nobody' user --users=GROUPNAME choose 'users' group --blank do not add users or groups, just the structure --server-role=ROLE The server role (domain controller | dc | member server | member | standalone). Default is dc. --function-level=FOR-FUN-LEVEL The domain and forest function level (2000 | 2003 | 2008 | 2008_R2 - always native). Default is (Windows) 2008_R2 Native. --base-schema=BASE-SCHEMA The base schema files to use. Default is (Windows) 2008_R2. --next-rid=NEXTRID The initial nextRid value (only needed for upgrades). Default is 1000. --partitions-only Configure Samba's partitions, but do not modify them (ie, join a BDC) --use-rfc2307 Use AD to store posix attributes (default = no) --machinepass=PASSWORD choose machine password (otherwise random) --plaintext-secrets Store secret/sensitive values as plain text on disk(default is to encrypt secret/ensitive values) --backend-store=BACKENDSTORE Specify the database backend to be used (default is tdb) --targetdir=DIR Set target directory (where to store provision) -q, --quiet Be quiet Samba Common Options: -s FILE, --configfile=FILE Configuration file -d DEBUGLEVEL, --debuglevel=DEBUGLEVEL debug level --option=OPTION set smb.conf option from command line --realm=REALM set the realm name Version Options: -V, --version Display version number
samba-tool ou create
# samba-tool ou create --help Usage: samba-tool ou create <ou_dn> [options] Create an organizational unit. The name of the new ou can be specified as a full DN or without the domainDN component. Examples: samba-tool ou create 'OU=OrgUnit' samba-tool ou create 'OU=SubOU,OU=OrgUnit,DC=samdom,DC=example,DC=com' The examples show how an administrator would create a new ou 'OrgUnit' and a new ou 'SubOU' as a child of the ou 'OrgUnit'. Options: -h, --help show this help message and exit -H URL, --URL=URL LDB URL for database or target server --description=DESCRIPTION OU's description Credentials Options: --simple-bind-dn=DN DN to use for a simple bind --password=PASSWORD Password -U USERNAME, --username=USERNAME Username -W WORKGROUP, --workgroup=WORKGROUP Workgroup -N, --no-pass Don't ask for a password -k KERBEROS, --kerberos=KERBEROS Use Kerberos --ipaddress=IPADDRESS IP address of server -P, --machine-pass Use stored machine account password --krb5-ccache=KRB5CCNAME Kerberos Credentials cache Samba Common Options: -s FILE, --configfile=FILE Configuration file -d DEBUGLEVEL, --debuglevel=DEBUGLEVEL debug level --option=OPTION set smb.conf option from command line --realm=REALM set the realm name Version Options: -V, --version Display version number
samba-tool user create
# samba-tool user create --help Usage: samba-tool user create <username> [<password>] [options] Create a new user. This command creates a new user account in the Active Directory domain. The username specified on the command is the sAMaccountName. User accounts may represent physical entities, such as people or may be used as service accounts for applications. User accounts are also referred to as security principals and are assigned a security identifier (SID). A user account enables a user to logon to a computer and domain with an identity that can be authenticated. To maximize security, each user should have their own unique user account and password. A user's access to domain resources is based on permissions assigned to the user account. Unix (RFC2307) attributes may be added to the user account. Attributes taken from NSS are obtained on the local machine. Explicitly given values override values obtained from NSS. Configure 'idmap_ldb:use rfc2307 = Yes' to use these attributes for UID/GID mapping. The command may be run from the root userid or another authorized userid. The -H or --URL= option can be used to execute the command against a remote server. Example1: samba-tool user create User1 passw0rd --given-name=John --surname=Smith --must-change-at-next-login -H ldap://samba.samdom.example.com -Uadministrator%passw1rd Example1 shows how to create a new user in the domain against a remote LDAP server. The -H parameter is used to specify the remote target server. The -U option is used to pass the userid and password authorized to issue the command remotely. Example2: sudo samba-tool user create User2 passw2rd --given-name=Jane --surname=Doe --must-change-at-next-login Example2 shows how to create a new user in the domain against the local server. sudo is used so a user may run the command as root. In this example, after User2 is created, he/she will be forced to change their password when they logon. Example3: samba-tool user create User3 passw3rd --userou='OU=OrgUnit' Example3 shows how to create a new user in the OrgUnit organizational unit. Example4: samba-tool user create User4 passw4rd --rfc2307-from-nss --gecos 'some text' Example4 shows how to create a new user with Unix UID, GID and login-shell set from the local NSS and GECOS set to 'some text'. Example5: samba-tool user create User5 passw5rd --nis-domain=samdom --unix- home=/home/User5 --uid-number=10005 --login-shell=/bin/false --gid- number=10000 Example5 shows how to create an RFC2307/NIS domain enabled user account. If --nis-domain is set, then the other four parameters are mandatory. Options: -h, --help show this help message and exit -H URL, --URL=URL LDB URL for database or target server --must-change-at-next-login Force password to be changed on next login --random-password Generate random password --smartcard-required Require a smartcard for interactive logons --use-username-as-cn Force use of username as user's CN --userou=USEROU DN of alternative location (without domainDN counterpart) to default CN=Users in which new user object will be created. E. g. 'OU=<OU name>' --surname=SURNAME User's surname --given-name=GIVEN_NAME User's given name --initials=INITIALS User's initials --profile-path=PROFILE_PATH User's profile path --script-path=SCRIPT_PATH User's logon script path --home-drive=HOME_DRIVE User's home drive letter --home-directory=HOME_DIRECTORY User's home directory path --job-title=JOB_TITLE User's job title --department=DEPARTMENT User's department --company=COMPANY User's company --description=DESCRIPTION User's description --mail-address=MAIL_ADDRESS User's email address --internet-address=INTERNET_ADDRESS User's home page --telephone-number=TELEPHONE_NUMBER User's phone number --physical-delivery-office=PHYSICAL_DELIVERY_OFFICE User's office location --rfc2307-from-nss Copy Unix user attributes from NSS (will be overridden by explicit UID/GID/GECOS/shell) --nis-domain=NIS_DOMAIN User's Unix/RFC2307 NIS domain --unix-home=UNIX_HOME User's Unix/RFC2307 home directory --uid=UID User's Unix/RFC2307 username --uid-number=UID_NUMBER User's Unix/RFC2307 numeric UID --gid-number=GID_NUMBER User's Unix/RFC2307 primary GID number --gecos=GECOS User's Unix/RFC2307 GECOS field --login-shell=LOGIN_SHELL User's Unix/RFC2307 login shell Credentials Options: --simple-bind-dn=DN DN to use for a simple bind --password=PASSWORD Password -U USERNAME, --username=USERNAME Username -W WORKGROUP, --workgroup=WORKGROUP Workgroup -N, --no-pass Don't ask for a password -k KERBEROS, --kerberos=KERBEROS Use Kerberos --ipaddress=IPADDRESS IP address of server -P, --machine-pass Use stored machine account password --krb5-ccache=KRB5CCNAME Kerberos Credentials cache Samba Common Options: -s FILE, --configfile=FILE Configuration file -d DEBUGLEVEL, --debuglevel=DEBUGLEVEL debug level --option=OPTION set smb.conf option from command line --realm=REALM set the realm name Version Options: -V, --version Display version number
samba-tool user move
# samba-tool user move --help Usage: samba-tool user move <username> <new_parent_dn> [options] Move a user to an organizational unit/container. 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. The command may be run from the root userid or another authorized userid. The -H or --URL= option can be used to execute the command against a remote server. Example1: samba-tool user move User1 'OU=OrgUnit,DC=samdom.DC=example,DC=com' -H ldap://samba.samdom.example.com -U administrator Example1 shows how to move a user User1 into the 'OrgUnit' organizational unit on a remote LDAP server. The -H parameter is used to specify the remote target server. Example2: samba-tool user move User1 CN=Users Example2 shows how to move a user User1 back into the CN=Users container on the local server. Options: -h, --help show this help message and exit -H URL, --URL=URL LDB URL for database or target server Credentials Options: --simple-bind-dn=DN DN to use for a simple bind --password=PASSWORD Password -U USERNAME, --username=USERNAME Username -W WORKGROUP, --workgroup=WORKGROUP Workgroup -N, --no-pass Don't ask for a password -k KERBEROS, --kerberos=KERBEROS Use Kerberos --ipaddress=IPADDRESS IP address of server -P, --machine-pass Use stored machine account password --krb5-ccache=KRB5CCNAME Kerberos Credentials cache Samba Common Options: -s FILE, --configfile=FILE Configuration file -d DEBUGLEVEL, --debuglevel=DEBUGLEVEL debug level --option=OPTION set smb.conf option from command line --realm=REALM set the realm name Version Options: -V, --version Display version number
samba-tool group add
# samba-tool group add --help Usage: samba-tool group add <groupname> [options] Creates a new AD group. This command creates a new Active Directory group. The groupname specified on the command is a unique sAMAccountName. An Active Directory group may contain user and computer accounts as well as other groups. An administrator creates a group and adds members to that group so they can be managed as a single entity. This helps to simplify security and system administration. Groups may also be used to establish email distribution lists, using --group- type=Distribution. Groups are located in domains in organizational units (OUs). The group's scope is a characteristic of the group that designates the extent to which the group is applied within the domain tree or forest. The group location (OU), type (security or distribution) and scope may all be specified on the samba-tool command when the group is created. The command may be run from the root userid or another authorized userid. The -H or --URL= option can be used to execute the command on a remote server. Example1: samba-tool group add Group1 -H ldap://samba.samdom.example.com --description='Simple group' Example1 adds a new group with the name Group1 added to the Users container on a remote LDAP server. The -U parameter is used to pass the userid and password of a user that exists on the remote server and is authorized to issue the command on that server. It defaults to the security type and global scope. Example2: sudo samba-tool group add Group2 --group-type=Distribution Example2 adds a new distribution group to the local server. The command is run under root using the sudo command. Example3: samba-tool group add Group3 --nis-domain=samdom --gid-number=12345 Example3 adds a new RFC2307 enabled group for NIS domain samdom and GID 12345 (both options are required to enable this feature). Options: -h, --help show this help message and exit -H URL, --URL=URL LDB URL for database or target server --groupou=GROUPOU Alternative location (without domainDN counterpart) to default CN=Users in which new user object will be created --group-scope=GROUP_SCOPE Group scope (Domain | Global | Universal) --group-type=GROUP_TYPE Group type (Security | Distribution) --description=DESCRIPTION Group's description --mail-address=MAIL_ADDRESS Group's email address --notes=NOTES Groups's notes --gid-number=GID_NUMBER Group's Unix/RFC2307 GID number --nis-domain=NIS_DOMAIN SFU30 NIS Domain Credentials Options: --simple-bind-dn=DN DN to use for a simple bind --password=PASSWORD Password -U USERNAME, --username=USERNAME Username -W WORKGROUP, --workgroup=WORKGROUP Workgroup -N, --no-pass Don't ask for a password -k KERBEROS, --kerberos=KERBEROS Use Kerberos --ipaddress=IPADDRESS IP address of server -P, --machine-pass Use stored machine account password --krb5-ccache=KRB5CCNAME Kerberos Credentials cache Samba Common Options: -s FILE, --configfile=FILE Configuration file -d DEBUGLEVEL, --debuglevel=DEBUGLEVEL debug level --option=OPTION set smb.conf option from command line --realm=REALM set the realm name Version Options: -V, --version Display version number