fstab mount shares on wifi network

Mike McGinn mikemcginn at mcginnweb.net
Tue Sep 6 19:18:08 UTC 2011


On Tuesday, September 06, 2011 14:55:52 Firesam wrote:
> How can I add an entry to fstab that mounts a samba share that is on a
> wireless network. The problem is that the network is not available until
> networkmanager connects to the lan. That only happens after I login to
> unity with my password. I dont think _netdev will help in this case. Is
> it smarter to use a script on connect to the network that will 'mount
> -a'?
You have to create a script in /etc/NetworkManager/dispatcher.d/
I called mine 05-mnt-hshares
I have it look at the essid 
I am quoting it below
# /etc/NetworkManager/dispatcher.d/05-mnt-hshares
# mount the shares I use at home when we connect
#!/bin/sh
export LC_ALL=C
if [ "$1" = "eth1" ]; then
        if [ "$2" = "up" ]; then
                SSID=`iwconfig $IFACE | awk -F\" '{print $2}'`
#       unmount work shares
                /root/bin/workUnNetStuff.sh
#       mount home shares
                if [ "$SSID" = "fishnet" ]; then
                        /root/bin/homeNetStuff.sh
                fi
#               /usr/sbin/vpnc
        fi
        if [ "$2" = "down" ]; then
                /root/bin/homeUnNetStuff.sh
#               /usr/sbin/vpnc-disconnect
        fi
fi

The script /root/bin/homeNetStuff.sh
#!/bin/bash
#resolvconf -u
smbmount //homestore/ourStuff/mikeBackUp /home/homeStore -o\ 
credentials=/home/mike/.hoStore.cred user=mike
smbmount //homestore/ourStuff /home/ourStuff -o\ 
credentials=/home/mike/.hoStore.cred user=mike


-- 
Mike McGinn		FACOCM
Ex Uno Plurima
No electrons were harmed in sending this message.
** Registered Linux User 377849




More information about the ubuntu-users mailing list