在创建主目录后运行 pam_exec CentOS 6

在创建主目录后运行 pam_exec CentOS 6

创建主目录后,如何运行pam_exec脚本?我已打开并通过/使用网络帐户。 /etc/pam.d/sshdCentOS 6.5PBISLikewise-Open

现在,如果新用户登录脚本运行,则会创建他们的主目录,这意味着用户必须注销并重新登录才能正常工作。

这是我的/etc/pam.d/sshd文件:

#%PAM-1.0
auth       required     pam_sepermit.so
auth       include      password-auth
account    required     pam_nologin.so
account    include      password-auth
password   include      password-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    required     pam_loginuid.so
session    optional     pam_exec.so log=/var/log/linkPublicHtml /usr/local/bin/linkPublicHtml.sh
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session    required     pam_selinux.so open env_params
session    optional     pam_keyinit.so force revoke
session    include      password-auth
session    sufficient      pam_lsass.so

答案1

尝试添加下面的行(就在该行上方:会话可选 pam_mkhomedir.so)

...
session     optional      pam_oddjob_mkhomedir.so umask=0077
session     optional      pam_exec.so log=/var/log/linkPublicHtml /usr/local/bin/linkPublicHtml.sh

相关内容