I've tried to setup EncFS to be mounted on user login as described in this guide excluding the Password Utility section, however it works with little success. The EncFS works properly (encryption/decryption tests work) but when I try to setup PAM via pam_script it just doesn't trigger the /etc/security/onauth or alike. Here are my final configs:The #cat /etc/pam.d/password-auth:#%PAM-1.0# This file is auto-generated.# User changes will be destroyed the next time authconfig is run.auth        required      pam_env.so# pam-script for EncFS mounting ......auth        optional      pam_script.so expose=1 runas=rootauth        sufficient    pam_unix.so nullok try_first_passauth        requisite     pam_succeed_if.so uid >= 1000 quiet_successauth        required      pam_deny.soaccount     required      pam_unix.soaccount     sufficient    pam_localuser.soaccount     sufficient    pam_succeed_if.so uid < 1000 quietaccount     required      pam_permit.sopassword    requisite     pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtokpassword    required      pam_deny.sosession     optional      pam_keyinit.so revokesession     required      pam_limits.so-session     optional      pam_systemd.sosession     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid# pam-script for EncFS mounting ......session     optional      pam_script.so runas=rootsession     required      pam_unix.soThe # cat /etc/security/onauth:#!/bin/sh## What: onauth, onsessionopen, onsessionclose# When: 5-Aug-2013# Who:  Philip Jensen# Why:  To capture login credentials to transparently fusermount an encrypted#       home directory for a user.## Setup varsUSER=$1PASSWORD=$PAM_AUTHTOKUSER_FILE=/tmp/__uPASSWORD_FILE=/tmp/__pLOG_FILE=/var/log/pam_script.logecho ONAUTH RUNNING script: ${PAM_AUTHTOK} ${PAM_USER}/bin/echo ------------------------------ >> ${LOG_FILE}date >> ${LOG_FILE}/bin/echo Run as `whoami` >> ${LOG_FILE}#echo Params passed to this script >> ${LOG_FILE}#echo \$0 = $0 >> ${LOG_FILE}#echo \$1 = $1 >> ${LOG_FILE}#echo \$2 = $2 >> ${LOG_FILE}#echo \$3 = $3 >> ${LOG_FILE}#echo \$PAM_AUTHTOK = ${PAM_AUTHTOK} >> ${LOG_FILE}#echo  >> ${LOG_FILE}capture_credentials() {        #        umask 277        /bin/echo ${USER} | base64 > ${USER_FILE}        /bin/echo ${PASSWORD} | base64 > ${PASSWORD_FILE}        exit 0}mount_encfs_home() {        USER=`cat ${USER_FILE} | base64 -d`        PASSWORD=`cat ${PASSWORD_FILE} | base64 -d`        #echo ${PASSWORD} | su - ${USER} -c /usr/bin/encfs -v -S /home/.encfs/${USER} /home/${USER} -- -o nonempty  >> ${LOG_FILE} 2>&1        echo ${PASSWORD} | su - ${USER} -c /usr/bin/encfs -v -S /home/.encfs/${USER} /home/${USER} -- -o nonempty  >> /dev/null 2>&1        rm ${USER_FILE} ${PASSWORD_FILE}}umount_encfs_home() {        echo Unmounting encrypted home dir /home/.encfs/${USER} from /home/${USER} >> ${LOG_FILE}        # need to do a lazy unmount to wait until the filesystem is clean.        #umount -l /home/${USER} >> ${LOG_FILE} 2>&1        umount -l /home/${USER} >> /dev/null 2>&1}case $0 in        *onauth)                echo Capturing credentials >> ${LOG_FILE}                capture_credentials                ;;        *onsessionopen)                echo Trying to mount encfs home >> ${LOG_FILE}                mount_encfs_home                ;;        *onsessionclose)                echo Trying to un-mount encfs home >> ${LOG_FILE}                umount_encfs_home                ;;esacecho ------------------------------ >> ${LOG_FILE}exit 0With proper symlinks as in # ll /etc/security/:...-rwxr-xr-x. 1 root root 2200 28. Jul 16:00 onauthlrwxrwxrwx. 1 root root   20 28. Jul 11:41 onsessionclose -> /etc/security/onauthlrwxrwxrwx. 1 root root   20 28. Jul 11:41 onsessionopen -> /etc/security/onauthI don't see anything in logs except for default messages in /var/log/secure:Jul 29 07:07:26 host_name su: pam_unix(su-l:auth): authentication failure; logname=...Jul 29 07:07:33 host_name su: pam_unix(su-l:session): session opened for user ...Jul 29 07:07:57 host_name su: pam_unix(su-l:session): session closed for user ...The pam_script seem to be installed properly as proven by:# ll /usr/lib64/security/ | grep script-rwxr-xr-x. 1 root root 15416 18. Jul 2014  pam_script.soand # ll /etc/ | grep pam_script-rwxr-xr-x.  1 root root   3837 18. Jul 2014  pam_scriptlrwxrwxrwx.  1 root root     10 28. Jul 09:01 pam_script_acct -> pam_scriptlrwxrwxrwx.  1 root root     10 28. Jul 09:01 pam_script_auth -> pam_scriptlrwxrwxrwx.  1 root root     10 28. Jul 09:01 pam_script_passwd -> pam_scriptlrwxrwxrwx.  1 root root     10 28. Jul 09:01 pam_script_ses_close -> pam_scriptlrwxrwxrwx.  1 root root     10 28. Jul 09:01 pam_script_ses_open -> pam_scriptThe problem is similar to this as it seems like onauth is just not triggered ever.
Can't setup mount of EncFS on user login
centos;pam