大网数据广告活动
服务器运维问答

Automatically create home directory on NFS after LDAP login

· 52CE 我爱测

My current situation is that I can successfully authenticate using ldap and pam , I also succeeded to use pam_mkdir to autocreate home directories in the /home filesystem. What now I'm trying to achieve is to autocreate the same …

问题原文

原帖链接 · rdbisme · CC BY-SA 3.0

My current situation is that I can successfully authenticate using ldap and pam, I also succeeded to use pam_mkdir to autocreate home directories in the /home filesystem.

What now I'm trying to achieve is to autocreate the same home directories but on an automounted nfs export. The automount works correctly and the homes root is correctly reachable. The aim is to avoid to create homes on the nfs manually.

I spent last two days lurking around, but I did not succeed to merge all the informations together.

The questions I still have:

  • could pam_mkdir create directories over nfs?
  • if the mounted homes path is not standard (e.g. homes are mounted to /mnt/nfs/homes), how pam_mkdir can know that? Using a homeDirectory LDAP attribute?
  • Should I instead trigger the creation on the LDAP server after user creation?
  • Am I overthinking an actually simpler problem?

已采纳解答

原帖链接 · techieb0y · CC BY-SA 3.0

It's most likely that you're running into an NFS permissions issue. In a standard setup, NFS client machines are not trusted for root access on the NFS server; access by uid=0 is mapped to an unprivileged user (nfsnobody or similar). In order to create the home directory, pam_mkdir (which runs as root) would need to have permissions to the directory in which the user's homedir would be created (generally /home/), and when remapped to nfsnobody, this fails. You could disable this remapping option, but that's generally a bad idea; the better approach is to have a script that walks your LDAP directory and creates missing home directories on the NFS server directly.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-08-26)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。