I was able to get a windows share to mount when users ssh into our server in a sub-dir in ~
. I now want it so that when they disconnect, the mount unmounts. I added this to /etc/bash.bashrc
but it doesn't seem to work.
finish() {
sudo /usr/local/bin/disconnect_mount.sh
}
trap finish EXIT
In the shell script I have this:
if ["$PAM_TYPE" = "close_session" ]; then
sudo umount ~/D
fi