AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1167532
Accepted
somenxavier
somenxavier
Asked: 2024-11-08 00:37:26 +0800 CST2024-11-08 00:37:26 +0800 CST 2024-11-08 00:37:26 +0800 CST

无法从 Windows 11 和 Linux 加入新的 Samba Active Directory

  • 772

我有一个包含 Windows Server 2003 Active Directory 服务器和 Windows 11 计算机的网络。我的计划是用 Fedora Linux Server Edition - fedora 40 替换 Windows Server 2003。我可以使用 Windows 11 客户端和一个 Fedora Linux 40 客户端对其进行测试。

旧境界是SONCANALS。新境界是SCNG。

我遵循Fedora 杂志的指南。

配置

  • 服务器 IP 是10.216.1.16,域名是scng.educaib

  • 服务器主机名是l1.scng.educaib

  • samba.conf:

    cat /etc/samba/smb.conf
    # Global parameters
    [global]
            dns forwarder = 1.1.1.1
            netbios name = L1
            realm = SCNG.EDUCAIB
            server role = active directory domain controller
            workgroup = SCNG
            idmap_ldb:use rfc2307 = yes
            ldap server require strong auth = no 
    
    [sysvol]
            path = /var/lib/samba/sysvol
            read only = No
    
    [netlogon]
            path = /var/lib/samba/sysvol/scng/scripts
            read only = No
    
  • Kerberos 配置:

    # cat /etc/krb5.conf.d/samba-dc 
    [libdefaults]
            default_realm = SCNG.EDUCAIB
            dns_lookup_realm = false
            dns_lookup_kdc = true
    
    [realms]
    SCNG.EDUCAIB = {
            default_domain = SCNG
    }
    
    [domain_realm]
            l1.scng.educaib = SCNG.EDUCAIB
    
  • /etc/systemd/resolved.conf.d/custom.conf:

    [Resolve]
    DNSStubListener=no
    Domains=scng.educaib
    DNS=10.216.1.16
    

我有一台装有 Fedora 40 的机器,我用它来测试 samba。当我测试时,一切都很好(教程指南中的“测试”部分)。当我运行 时realm discover,我只能得到旧领域,而不是新领域:

realm discover -v
 * Resolving: _ldap._tcp.soncanals
 * Performing LDAP DSE lookup on: 10.216.1.2
 * Performing LDAP DSE lookup on: 10.216.1.10
 * Performing LDAP DSE lookup on: 10.216.1.4
 * Successfully discovered: soncanals
soncanals
  type: kerberos
  realm-name: SONCANALS
  domain-name: soncanals
  configured: no
  server-software: active-directory
  client-software: sssd
  required-package: sssd-common
  required-package: oddjob
  required-package: oddjob-mkhomedir
  required-package: sssd-ad
  required-package: adcli
  required-package: samba-common-tools

在 Windows 中,当我尝试加入时SCNG,系统提示我以管理员身份登录,但是当我输入凭据时,它花费的时间太长并且会离开对话框。

图像

我该如何对这里的问题进行分类?例如,我可以看到哪些日志(我有很多日志/var/log/samba/)。我的 Samba 版本是 4.20.5。

我的首要任务是加入新域并以该域中的普通用户身份登录 Windows。我暂时放弃共享目录。

编辑(2024-11-11):Fedora Magazine 指南中的测试已通过:

测试

连接测试

$ smbclient -L localhost -N
Anonymous login successful

        Sharename       Type      Comment
        ---------       ----      -------
        sysvol          Disk      
        netlogon        Disk      
        IPC$            IPC       IPC Service (Samba 4.21.1)
SMB1 disabled -- no workgroup available

$ smbclient //localhost/netlogon -UAdministrator -c 'ls'
Password for [SCNG\Administrator]:
  .                                   D        0  Thu Oct 31 10:17:05 2024
  ..                                  D        0  Thu Oct 31 10:17:05 2024

                15663104 blocks of size 1024. 12979380 blocks available

DNS 测试

$ host -t SRV _ldap._tcp.scng.educaib.
_ldap._tcp.scng.educaib has SRV record 0 100 389 l1.scng.educaib.
$ host -t SRV _kerberos._udp.scng.educaib.
_kerberos._udp.scng.educaib has SRV record 0 100 88 l1.scng.educaib.
$ host -t A l1.scng.educaib.
l1.scng.educaib has address 10.216.1.16

Kerberos 测试

$  kinit administrator
Password for [email protected]: 
ladmin@l1:~$ klist
Ticket cache: KCM:1000
Default principal: [email protected]

Valid starting     Expires            Service principal
11/11/24 10:15:10  11/11/24 20:15:10  krbtgt/[email protected]
        renew until 18/11/24 10:15:06
active-directory
  • 2 2 个回答
  • 254 Views

2 个回答

  • Voted
  1. mfinni
    2024-11-09T01:32:50+08:002024-11-09T01:32:50+08:00

    您几乎肯定需要为新域添加 DNS 记录。 Fedora 杂志有“DNS 测试”子标题,可显示如何知道您是否做对了。

    • 0
  2. Best Answer
    somenxavier
    2024-12-06T01:05:21+08:002024-12-06T01:05:21+08:00

    问题是服务器和客户端需要在同一个域中。由于我们需要完全限定域,SCNG.LOCAL因此我们只需要SCNG或SCNG.EDUCAIB。

    在我的例子中,Samba 服务器有主机名l1.scng.local和静态 IP 10.216.1.16。我的网关是10.216.1.1

    • 在服务器端,按照指南上的说明进行操作。我将samba-tool domain provision步骤更改为:

      samba-tool domain provision --server-role=dc --use-rfc2307 --interactive
      

      因为它允许以交互方式输入管理员密码。我的配置是:

       # cat /etc/samba/smb.conf
       # Global parameters
       [global]
               dns forwarder = 1.1.1.1
               netbios name = L1
               realm = SCNG.LOCAL
               server role = active directory domain controller
               workgroup = SCNG
               idmap_ldb:use rfc2307 = yes
      
       [sysvol]
               path = /var/lib/samba/sysvol
               read only = No
      
       [netlogon]
               path = /var/lib/samba/sysvol/scng.local/scripts
               read only = No
      
        # cat /etc/krb5.conf.d/samba-dc
        [libdefaults]
                default_realm = SCNG.LOCAL
                dns_lookup_realm = false
                dns_lookup_kdc = true
      
        [realms]
               SCNG.LOCAL = {
                  default_domain = SCNG
               }
      
        [domain_realm]
               l1.scng.local = SCNG.LOCAL
      

      其他重要配置是:

       # cat /etc/systemd/resolved.conf.d/custom.conf 
       [Resolve]
       DNSStubListener=no
       Domains=scng.local
       DNS=10.216.1.16
      
       root@l1:/home/ladmin# cat /etc/hostname 
       l1.scng.local
      
       root@l1:/home/ladmin# cat /etc/resolv.conf 
       # This is /run/systemd/resolve/resolv.conf managed by man:systemd-resolved(8).
       # Do not edit.
       #
       # This file might be symlinked as /etc/resolv.conf. If you're looking at
       # /etc/resolv.conf and seeing this text, you have followed the symlink.
       #
       # This is a dynamic resolv.conf file for connecting local clients directly to
       # all known uplink DNS servers. This file lists all configured search domains.
       #
       # Third party programs should typically not access this file directly, but only
       # through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
       # different way, replace this symlink by a static file or a different symlink.
       #
       # See man:systemd-resolved.service(8) for details about the supported modes of
       # operation for /etc/resolv.conf.
      
       nameserver 10.216.1.16
       nameserver 10.216.1.4
       nameserver 1.1.1.1
       search scng.local
      

      这10.216.1.4是我本地网络的 DNS。可以随意填写。我在 Fedora Guide 中将其替换8.8.8.8为。1.1.1.1

    • 在客户端,我们需要将客户端 DNS 设置为服务器 IP。此 DNS 设置至关重要。在我的例子中,客户端具有静态 IP 10.216.1.192。因此,我需要使用网关10.216.1.1和 DNS IP配置网络10.216.1.16:

      1. 设置与服务器同一网络的主机名:hostnamectl hostname l192.scng.local

      2. 将 DNS 服务器设置为 Samba 服务器。重复服务器指南中的相同步骤:创建/etc/systemd/resolved.conf.d/custom.conf内容:

         [Resolve]
         DNSStubListener=no
         Domains=scng.local
         DNS=10.216.1.16
        

      然后运行systemctl restart systemd-resolved。因此配置如下:

          cat /etc/resolv.conf 
          nameserver 10.216.1.16
          nameserver 10.216.1.16
          search scng.local
      

    然后就realm discover -v可以工作了(scng.local出现)。然后您可以加入客户端scng.local:realm join scng.local。现在您可以使用登录<your username>@scng.local。

    • 0

相关问题

  • 如果以域用户身份远程登录,PC 速度极慢

  • 如何在 Windows 2003 的 ou 级别应用策略

  • 允许用户更改其 Active Directory 密码的 Web 界面

  • MOSS 2007 无法使用 ActiveDirectoryMembershipProvider 配置表单身份验证

  • 通过 VPN 更改 Active Directory 密码

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve