diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2019-10-11 06:25:21 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2019-10-11 06:25:21 +0200 |
commit | b23e9400c36acf9856606165489e8828c2cf8dd5 (patch) | |
tree | 581468996aa8202b9121c8031ee50bf60984a816 /roles/ands_kitauth/files/scripts/login_script.sh | |
parent | b17d3d74eb5a9e7640d94f98f6b27ce4891b3c26 (diff) | |
download | itm-b23e9400c36acf9856606165489e8828c2cf8dd5.tar.gz itm-b23e9400c36acf9856606165489e8828c2cf8dd5.tar.bz2 itm-b23e9400c36acf9856606165489e8828c2cf8dd5.tar.xz itm-b23e9400c36acf9856606165489e8828c2cf8dd5.zip |
ipa-client and fine tunning
Diffstat (limited to 'roles/ands_kitauth/files/scripts/login_script.sh')
-rwxr-xr-x | roles/ands_kitauth/files/scripts/login_script.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/roles/ands_kitauth/files/scripts/login_script.sh b/roles/ands_kitauth/files/scripts/login_script.sh new file mode 100755 index 0000000..9b66968 --- /dev/null +++ b/roles/ands_kitauth/files/scripts/login_script.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Script to authomatecly create user home directories +# Shall we consider creating both NFS and local homes? Or shall we just create it on NFS? + +LOG=/var/log/login_script +DATE=`/bin/date +"%b %d %H:%M:%S"` + +if [ x${PAM_TYPE} == "xopen_session" ]; then set $(getent passwd $PAM_USER | awk -F ":" '{print $3" "$4" "$5" "$6}') + USERUID=$1; USERGID=$2; USERHOME=$4 + + echo "[$DATE]: login of $PAM_USER: UID=$USERUID: GID=$USERGID: HOME=$USERHOME: from $PAM_RHOST via $PAM_SERVICE" >> $LOG + + if [ ! -z "${USERHOME}" -a ! -d ${USERHOME} ]; then + #if [ ! -d /home/${USERHOME} ]; then + echo " Home for user ${USERNAME} does not exist at ${USERHOME} => creating" >> $LOG + + mkdir -p $USERHOME + cp -af /etc/skel/.[a-zA-Z]* $USERHOME + chown -R $USERUID.$USERGID $USERHOME + chmod 701 $USERHOME + chmod g+s $USERHOME + fi +fi +if [ x${PAM_TYPE} == "xclose_session" ]; then + echo "[$DATE]: logout of $PAM_USER $USERUID" >> $LOG +fi |