I'm trying to mount a couple of nfs shares after my openvpn tunnel is up. Previously this worked on ubuntu 12.04 and ubuntu 14.04. I made a clean install with ubuntu 16.04 and can't get it to work.
To simplify testing I use the current mount script to figure out why things don't work:
#!/bin/bash echo "mounting testdir.." echo "I am:" `whoami` echo `id` /bin/mount -v --bind /mnt/testdir1 /mnt/testdir2-mountbind/ echo "testdir mounted!"
When I execute this from the command line it works:
xxx@xxx:~$ sudo /mnt/mounttest.sh mounting testdir.. I am: root uid=0(root) gid=0(root) groups=0(root) mount: /mnt/testdir1 bound on /mnt/testdir2-mountbind. testdir mounted! xxx@xxx:~$
However, when I configure this as
route-up /mnt/mounttest.sh in my openvpn I get a permission denied error. I suspect that this is also the problem when I try to mount nfs shares but they simply hang and don't give me any extra info. Openvpn output/log:
xxx@xxx:~$ sudo service openvpn@xxx start xxx@xxx:~$ sudo tail /var/log/openvpn/openvpn.xxx.log Sun Nov 27 10:37:56 2016 /sbin/ip link set dev tun0 up mtu 1500 Sun Nov 27 10:37:56 2016 /sbin/ip addr add dev tun0 local 10.20.31.94 peer 10.20.31.93 Sun Nov 27 10:37:56 2016 /sbin/ip route add 10.20.30.0/24 via 10.20.31.93 Sun Nov 27 10:37:56 2016 /sbin/ip route add 10.20.31.0/24 via 10.20.31.93 mounting testdir.. I am: root uid=0(root) gid=0(root) groups=0(root) mount: permission denied testdir mounted! Sun Nov 27 10:37:56 2016 Initialization Sequence Completed xxx@xxx:~$