我们正在使用 SSSD 来验证 CentOS 服务器上的用户。当默认主目录为 /home 时,oddjobd-mkhomedir 工作得很好,但在特定服务器上,我们必须将默认主目录更改为 /data,它位于 SAN 安装上。
现在,每次用户尝试登录时,他们都会被放入带有以下消息的 bash shell。
Creating home directory for first.last.
Could not chdir to home directory /data/X.Y.local/first.last: No such file or directory
-bash-4.1$
Run Code Online (Sandbox Code Playgroud)
每次尝试时,我都会看到以下 AVC 拒绝消息:
type=AVC msg=audit(1492004159.114:1428): avc: denied { create } for pid=2832
comm="mkhomedir" name="x.y.local"
scontext=system_u:system_r:oddjob_mkhomedir_t:s0-s0:c0.c1023
tcontext=system_u:object_r:default_t:s0 tclass=dir
Run Code Online (Sandbox Code Playgroud)
确保更改 /data 的上下文。
drwxr-xr-x. root root system_u:object_r:home_root_t:s0 data
Run Code Online (Sandbox Code Playgroud)
如果 /data 与 /home 具有相同的上下文,为什么 SELinux 限制oddjobd 创建 /data/XYlocal/first.last ?
# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from …Run Code Online (Sandbox Code Playgroud) selinux ×1