Quantcast
Channel: S.G. Vulcan
Viewing all articles
Browse latest Browse all 65

Mount a remote fs after connecting to a vpn. (NetwrokManager)

$
0
0

When away I use a vpn connection to connect to my home server. The first thing after connecting is usually mounting some resources using sshfs (yes I know, not very efficient but for personal use is more than enough). I wanted to automate that and so I dug a bit around NetworkManager.

Apparently all you have to do is drop a script similar to this in /etc/NetworkManager/dispatcher.d/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
interface=$1
status=$2

LOG="/var/log/network_manager_custom.log"

if [ "$CONNECTION_UUID" = "xxx-xxx-xxx" ]; then
case $status in
vpn-up)
mount /mnt/something >> $LOG 2>&1
;;
vpn-down)
umount /mnt/something >> $LOG 2>&1
;;
esac
fi

Make it executable and be sure it is not world writeable.


Viewing all articles
Browse latest Browse all 65

Trending Articles