Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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;

logger "Looking at case"

case "$2" in
    logger "Inside vpn-up"
    sshfs username@host:/home/common   /media/host-common
    sshfs username@host:/home/username /media/host-home
    logger "Mounted all drives"
    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
share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.