配置winbind

1.配置/etc/nsswitch

文件 /etc/nsswitch 告诉系统在哪里查找密码和组等。
此处显示的定义将使其首先查看本地文件 /etc/passwd 和 /etc/group,然后使用 winbind 查询 Window Server:

# /etc/nsswitch.conf
...
passwd:     files winbind
shadow:     files winbind
group:      files winbind
...

2.更新PAM配置文件

在主要 PAM 身份验证配置文件 /etc/pam.d/system-auth 中,替换 auth 行:

auth required /lib/security/pam_securetty.so
auth required /lib/security/pam_nologin.so
auth sufficient /lib/security/pam_winbind.so
auth required /lib/security/pam_unix.so   use_first_pass shadow nullok

与以下行:

account required /lib/security/pam_winbind.so

3.加入域

为了加入域,像这样使用 net 程序:

# net join -S PDC -U Administrator

-U 后面的用户名可以是在机器上具有管理员权限的任何域用户。
将 PDC/窗口服务器的名称或者 IP 替换为“PDC”

4.修改/etc/samba/smb.conf

修改 /etc/samba/smb.conf 使其包含如下指令:

# vi /etc/samba/smb.conf
[global]
winbind separator = +
winbind cache time = 10
template shell = /bin/bash
template homedir = /home/%D/%U
idmap uid = 10000-20000
idmap gid = 10000-20000
workgroup = DOMAIN
security = domain
password server = *

5. 启动 winbind 服务。

启动 winbind,我们应该会发现用户和组数据库已扩展为包括 NT 用户和组,并且我们可以使用 DOMAIN+user 语法作为用户名以域用户身份登录到 unix box。

# service winbind start

winbind 服务启动后,我们可以使用 wbinfo 工具从 winbind 守护程序检查/获取信息。

# wbinfo
Usage: wbinfo [OPTION...]
  -u, --domain-users                   Lists all domain users
  -g, --domain-groups                  Lists all domain groups
  -N, --WINS-by-name=NETBIOS-NAME      Converts NetBIOS name to IP
  -I, --WINS-by-ip=IP                  Converts IP address to NetBIOS name
  -n, --name-to-sid=NAME               Converts name to sid
  -s, --sid-to-name=SID                Converts sid to name
  -U, --uid-to-sid=UID                 Converts uid to sid
  -G, --gid-to-sid=GID                 Converts gid to sid
  -S, --sid-to-uid=SID                 Converts sid to uid
  -Y, --sid-to-gid=SID                 Converts sid to gid
  -A, --allocate-rid                   Get a new RID out of idmap
  -c, --create-user=name               Create a local user account
  -x, --delete-user=name               Delete a local user account
  -C, --create-group=name              Create a local group
  -X, --delete-group=name              Delete a local group
  -o, --add-to-group=user:group        Add user to group
  -O, --del-from-group=user:group      Remove user from group
  -t, --check-secret                   Check shared secret
  -m, --trusted-domains                List trusted domains
  --sequence                           Show sequence numbers of all domains
  -D, --domain-info=STRING             Show most of the info we have about the
                                       domain
  -r, --user-groups=USER               Get user groups
  --user-sids=SID                      Get user group sids for user SID
  -a, --authenticate=user%password     authenticate user
  --set-auth-user=user%password        Store user and password used by
                                       winbindd (root only)
  --get-auth-user                      Retrieve user and password used by
                                       winbindd (root only)
  -p, --ping                           Ping winbindd to see if it is alive
  --domain=domain                      Define to the domain to restrict
                                       operation
Linux 操作系统“winbind”服务

winbind服务说明

Winbind 通过允许 UNIX 机器成为 NT 域的完整成员来统一 UNIX 和 Windows NT 帐户管理。
winbind 守护进程提供的服务称为 winbind,可用于从 Windows NT 服务器解析用户和组信息,这使得 UNIX 平台可以理解它。
该服务还可以通过关联的 PAM 模块提供身份验证服务。
pam_winbind 模块支持 auth、account 和 password 模块类型。

winbind 服务由 samba-common 包提供,作为 samba 的一个组件。

更多: zhilu jiaocheng

服务控制

要立即控制 winbind 服务,请使用“service”或者“systemctl”实用程序:

# service winbind
Usage: /etc/init.d/winbind {start|stop|restart|reload|status|condrestart}
日期:2020-09-17 00:14:39 来源:oir作者:oir