create_vmware_tmpdir() { local tmpdir="/tmp/vmware-${PAM_USER}" [ -d "$tmpdir" ] || mkdir -p "$tmpdir" grep -qE '^tmpfs\s+'"$tmpdir" /proc/mounts && return 0 local mount_opts="-o mode=0700,size=100%" local user_uid="$(id -u $PAM_USER)" [ -n "$user_uid" ] && mount_opts="${mount_opts},uid=${user_uid}" local user_gid="$(id -g $PAM_USER)" [ -n "$user_gid" ] && mount_opts="${mount_opts},gid=${user_gid}" # NO QUOTES!!!1 mount -t tmpfs tmpfs ${mount_opts} "$tmpdir" } if [ "x$PAM_SERVICE" != "xsu" -a "x$PAM_SERVICE" != "xsudo" ]; then create_vmware_tmpdir fi true