this problem is really frustrating me. I have the following script to mount/unmount a sshfs upon a vpn connection (vpn-up) and vpn-down. I have this script in /etc/NetworkManager/dispatcher.d/ directory. When I run the script manually saying "sudo mount-on-vpn asdf vpn-up" it runs fine. But whenever NetworkManager wants to run it it fails and the syslog says "script exited with error -1". I debugged it a lil bit and found that it fails in the "sshfs username@host:...." I am pretty sure the options are correct because when I run the same command (by copy/pasting) on the console it works.
Any idea what could be going wrong here ?
The directories /media/host-common and /meidia-home are all owned by the username and set to 777 as permission.
#!/bin/sh -e
if [ -z "$1" ]; then
echo "$0: called with no interface" 1>&2
exit 1;
fi
logger "Looking at case"
case "$2" in
vpn-up)
logger "Inside vpn-up"
sshfs username@host:/home/common /media/host-common
sshfs username@host:/home/username /media/host-home
logger "Mounted all drives"
;;
vpn-down)
logger "Inside vpn-down"
fusermount -u /media/host-common
fusermount -u /media/host-home
logger "Unmounting all drives"
;;
*)
logger "Inside *"
echo "$0: called with unknown action \`$2'" 1>&2
logger "Exiting"
exit 1
;;
esac