0

I have a connection to a work network over VPN. When on the corporate network in the office, my mount reads the fstab and mounts no problem (after login and getting kerberos ticket)

I would like to do the same on the VPN connection. I have read up on adding scripts to here; /etc/NetworkManager/dispatcher.d in order to achieve this and the 2 arguments passed to scripts in here. This is what I have;

#!/bin/bash

INTERFACE="$1"
STATUS="$2"
LOG='/var/log/NetworkManager_vpn_mount.log'

if [ "$STATUS" = "up" ]; then
        if [ "$INTERFACE" = "vpn0" ] || [ "$INTERFACE" = "cscotun0" ]; then
        sleep 5
        sudo -u userName mount /home/workDomain/userName/homeDrive >> ${LOG}
        fi
fi

After connection to the VPN, nothing goes to the log file so I am unsure as to where I'm going wrong to get the mount to actually mount

If I run the command ; sudo -u userName mount /home/workDomain/userName/homeDrive manually after connecting to the VPN it works fine

Found this in /var/log/syslog

Apr 30 14:56:11 uc39e2f5d6dd556 nm-dispatcher[1193]: mount: /home/workDomain/userName/homeDrive: Required key not available
Apr 30 14:56:11 uc39e2f5d6dd556 kernel: [23833.235190] CIFS VFS: Send error in SessSetup = -126
Apr 30 14:56:11 uc39e2f5d6dd556 nm-dispatcher: req:2 'up' [vpn0], "/etc/NetworkManager/dispatcher.d/zz-mount-dfs": complete: failed with Script '/etc/NetworkManager/dispatcher.d/zz-mount-dfs' exited with error status 1.
Apr 30 14:56:11 uc39e2f5d6dd556 NetworkManager[1283]: <warn>  [1588254971.2789] dispatcher: (16) zz-mount-dfs failed (failed): Script '/etc/NetworkManager/dispatcher.d/zz-mount-dfs' exited with error status 1.
6
  • What does stat -c '%A %g %u' /etc/NetworkManager/dispatcher.d/$filename (obviously with _your $filename) say? What I am trying to find out is whether the script is executable and owned by the right user. Sounds like a trivial mistake, but I've made it, so ... Apr 30, 2020 at 8:41
  • -rwxr-xr-x 0 0
    – eekfonky
    Apr 30, 2020 at 8:52
  • And, since you dodged answering that part of my question, the name of the script is? Maybe I am entirely wrong, but I was under the impression that it ought to start with two digits, followed by a dash and a name. Btw, I've only ever tried using #!/bin/sh -e as the hashbang. Apr 30, 2020 at 8:55
  • Sorry, it's zz-mount-dfs as I want it to run last after all the sysadmin files do their thing. I was under the impression they ran alphabetically so numbers, then letters
    – eekfonky
    Apr 30, 2020 at 8:56
  • wiki.archlinux.org/index.php/…
    – eekfonky
    Apr 30, 2020 at 9:02

0

You must log in to answer this question.

Browse other questions tagged .