0

How can I make a pam_exec script in /etc/pam.d/sshd run after the home directory has been created? I am on CentOS 6.5 and use network accounts via PBIS / Likewise-Open.

Right now, if a new user logs in the script runs, then their home directory is created which means the user has to log out and back in for things to work right.

Here is my /etc/pam.d/sshd file:

#%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
Abhijeet Kasurde
  • 983
  • 9
  • 20
GeneBean
  • 323
  • 1
  • 4
  • 11

1 Answers1

1

try that added the line below (just above the line: session optional 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
Sergey
  • 11
  • 1