在托管 Squid 服务的服务器上配置 Samba

2023年12月13日

ID 166650

要配置 Samba 服务:

  1. 启动 Samba 服务并将其添加到自动启动。为此,请根据所使用的操作系统运行以下命令:
    • CentOS, Red Hat Enterprise Linux 或 SUSE Linux Enterprise Server:

      systemctl start smb

      systemctl enable smb

      systemctl start nmb

      systemctl enable nmb

    • Ubuntu 或 Debian:

      systemctl start smbd

      systemctl enable smbd

      systemctl start nmbd

      systemctl enable nmbd

  2. 添加以下参数到 /etc/samba/smb.conf 文件:

    [全局]

    workgroup = <Active Directory 域的 NetBIOS 名称>

    password server = <Active Directory 域控制器的 DNS 名称>

    realm = <大写的 Active Directory 域名>

    security = ads

    idmap uid = 10000-20000

    idmap gid = 10000-20000

    winbind use default domain = no

    winbind request timeout = 300

  3. 将托管 Squid 服务的服务器添加到 Active Directory 域。为此,请执行命令:

    net ads join -U <domain administrator>

    您将被提示输入域管理员的密码或有域管理员权限的用户的密码。

  4. 请输入管理员密码然后按 ENTER 键。

    托管 Squid 服务的服务器应该被添加到 Active Directory 域。

  5. 请确保托管 Squid 服务的服务器确实添加到了 Active Directory 域。为此,请执行命令:

    net ads testjoin

    如果托管 Squid 服务的服务器已被添加到 Active Directory 域,控制台中会显示 Join is OK

  6. 重启 Samba 服务。为此,请根据所使用的操作系统运行以下命令:
    • CentOS, Red Hat Enterprise Linux 或 SUSE Linux Enterprise Server。

      systemctl restart smb

      systemctl restart nmb

    • Ubuntu 或 Debian。

      systemctl restart smbd

      systemctl restart nmbd

    如果您看到 "ERROR: failed to setup guest info", 您必须配置访客组的映射。为此,请运行命令 net groupmap add sid=S-1-5-32-546 unixgroup=nobody type=builtin

  7. 启动 winbind 服务。为此,请执行命令:

    systemctl start winbind

  8. 添加 winbind 服务进行自动启动。为此,请执行命令:

    systemctl enable winbind

  9. 如果使用 Ubuntu or Debian, 请将 ‘代理’ 用户添加到 ‘winbindd_priv’ 组。为此,请执行命令:

    usermod -a -G winbindd_priv proxy

Samba 配置将完成。继续检查 Samba 设置。

Did you find this article helpful?
What can we do better?
Thank you for your feedback! You're helping us improve.
Thank you for your feedback! You're helping us improve.