Fedora 34
Sponsored Link

Samba : Samba Winbind2021/05/20

 
Samba Winbind で Windows の Active Directory ドメインに参加します。
ローカルネットワークに Windows Active Directory Domain Service が稼働していることが前提です。
当例では、以下のような Active Directory ドメイン環境で設定します。
ドメインサーバー : Windows Server 2019
ドメイン名 : srv.world
ホスト名 : fd3s.srv.world
NetBIOS 名 : FD3S01
レルム : SRV.WORLD
[1] Winbind をインストールします。
[root@smb ~]#
dnf -y install samba-winbind samba-winbind-clients oddjob-mkhomedir
[2] Active Directory ドメインに参加できるよう設定します。
[root@smb ~]#
vi /etc/krb5.conf
# 20行目 : コメント解除してレルム名を指定

default_realm =
SRV.WORLD
# 24-27行目 : コメント解除してレルム名と AD のホスト名を指定

[realms]
  SRV.WORLD = {
      kdc = fd3s.srv.world
      admin_server = fd3s.srv.world
  }

[root@smb ~]#
mv /etc/samba/smb.conf /etc/samba/smb.conf.org

[root@smb ~]#
vi /etc/samba/smb.conf
# 以下のように新規作成

# [realm] と [workgroup] は自身の環境に置き換え

[global]
        kerberos method = secrets and keytab
        realm = SRV.WORLD
        workgroup = FD3S01
        security = ads
        template shell = /bin/bash
        winbind enum groups = Yes
        winbind enum users = Yes
        winbind separator = +
        idmap config * : rangesize = 1000000
        idmap config * : range = 1000000-19999999
        idmap config * : backend = autorid

# 認証プロバイダーを Winbind に切り替え

[root@smb ~]#
authselect select winbind --force

Profile "winbind" was selected.
The following nsswitch maps are overwritten by the profile:
- passwd
- group

Make sure that winbind service is configured and enabled. See winbind documentation for more information.

# 必要があれば有効に設定 (初回ログイン時にホームディレクトリを自動生成)

[root@smb ~]#
authselect enable-feature with-mkhomedir

[root@smb ~]#
systemctl enable --now oddjobd
[3] Active Directory ドメインに参加します。
# 参照する DNS を AD に変更しておく

[root@smb ~]#
nmcli connection modify enp1s0 ipv4.dns 10.0.0.100

[root@smb ~]#
nmcli connection down enp1s0; nmcli connection up enp1s0

Connection 'enp1s0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/1)
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
# ドメインに参加 [-U (AD ユーザー)]

[root@smb ~]#
net ads join -U Administrator

Enter Administrator's password:
Using short domain name -- FD3S01
Joined 'SMB' to dns domain 'srv.world'
No DNS domain configured for smb. Unable to perform DNS Update.
DNS update failed: NT_STATUS_INVALID_PARAMETER
[root@smb ~]#
systemctl enable --now winbind
# ドメイン情報表示

[root@smb ~]#
net ads info

LDAP server: 10.0.0.100
LDAP server name: fd3s.srv.world
Realm: SRV.WORLD
Bind Path: dc=SRV,dc=WORLD
LDAP port: 389
Server time: Thu, 20 May 2021 11:24:00 JST
KDC server: 10.0.0.100
Server time offset: 0
Last machine account password change: Thu, 20 May 2021 11:23:45 JST

# AD ユーザー情報表示

[root@smb ~]#
wbinfo -u

FD3S01+administrator
FD3S01+guest
FD3S01+krbtgt
FD3S01+serverworld
FD3S01+sqladmin
FD3S01+ldapuser
FD3S01+cent
FD3S01+fedora

# AD ユーザーでログイン可能か確認

[root@smb ~]#
exit

logout

Fedora 34 (Server Edition)
Kernel 5.11.12-300.fc34.x86_64 on an x86_64 (ttyS0)

Activate the web console with: systemctl enable --now cockpit.socket

smb login: FD3S01+serverworld
Password:
[FD3S01+serverworld@smb ~]$ id
uid=2001105(FD3S01+serverworld) gid=2000513(FD3S01+domain users) groups=2000513(FD3S01+domain users),2000512(FD3S01+domain admins),2000572(FD3S01+denied rodc password replication group),2001105(FD3S01+serverworld) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
関連コンテンツ