Red Hat Training

A Red Hat training course is available for RHEL 8

111.2. 在 IdM 客户端中安装和配置 Samba 服务器

您可以在 IdM 域中注册的客户端上安装和配置 Samba。

先决条件

流程

  1. 安装ipa-client-samba软件包:

    [root@idm_client]# yum install ipa-client-samba
  2. 使用ipa-client-samba工具准备客户端并创建初始 Samba 配置:

    [root@idm_client]# ipa-client-samba
    Searching for IPA server...
    IPA server: DNS discovery
    Chosen IPA master: idm_server.idm.example.com
    SMB principal to be created: cifs/idm_client.idm.example.com@IDM.EXAMPLE.COM
    NetBIOS name to be used: IDM_CLIENT
    Discovered domains to use:
    
     Domain name: idm.example.com
    NetBIOS name: IDM
             SID: S-1-5-21-525930803-952335037-206501584
        ID range: 212000000 - 212199999
    
     Domain name: ad.example.com
    NetBIOS name: AD
             SID: None
        ID range: 1918400000 - 1918599999
    
    Continue to configure the system with these values? [no]: yes
    Samba domain member is configured. Please check configuration at /etc/samba/smb.conf and start smb and winbind services
  3. 默认情况下,ipa-client-samba会自动将[homes]部分添加到/etc/samba/smb.conf文件中,该文件在用户连接时动态共享用户的主目录。如果用户在这个服务器上没有主目录,或者您不想共享主目录,请从/etc/samba/smb.conf中删除以下行:

    [homes]
        read only = no
  4. 共享目录和打印机。详情请查看以下部分:

  5. 在本地防火墙中打开 Samba 客户端所需的端口:

    [root@idm_client]# firewall-cmd --permanent --add-service=samba-client
    [root@idm_client]# firewall-cmd --reload
  6. 启用并启动smbwinbind服务:

    [root@idm_client]# systemctl enable --now smb winbind

验证步骤

在安装了 samba-client 软件包的不同的 IdM 域成员上运行以下验证步骤:

  • 使用 Kerberos 身份验证列出 Samba 服务器中的共享:

    $ smbclient -L idm_client.idm.example.com -U user_name --use-kerberos=required
    lp_load_ex: changing to config backend registry
    
        Sharename       Type      Comment
        ---------       ----      -------
        example         Disk
        IPC$            IPC       IPC Service (Samba 4.15.2)
    ...

其它资源

  • ipa-client-samba(1) man page