automatically mount network drive - 10.04 LTS

Arnaud G lepelerin2002 at yahoo.com
Thu Feb 17 13:47:37 UTC 2011




________________________________
From: Avi Schwartz <ubuntu-users352 at cfftechnologies.com>
To: "Ubuntu user technical support, not for general discussions" 
<ubuntu-users at lists.ubuntu.com>
Sent: Mon, February 14, 2011 10:50:21 PM
Subject: Re: automatically mount network drive - 10.04 LTS


On 02/14/2011 07:58       PM, Arnaud G wrote:

I am back to the drawing board. Below is what I need to           accomplish. I 
have been looking around, trying different           solutions, experimenting 
but so far I am not satisfied with           the result I got.
>
>We are migrating people, in my university, to Ubuntu 10.04           LTS. On the 
>"desktop" side (approx 500 users) LTSP will be           used. It works. So far 
>so good.
>By default everything is saved under their "Documents" folder.
>
>My problem is about the laptop users. They will have 10.04 LTS           
>installed on their machine.  When they use their laptop their           work is 
>saved by default in their "Documents" folder. So far           everything is 
>good.
>I would like to synchronize their laptop "Documents" folder to           their 
>network drive "Documents" folder. I can use rsync for           that once their 
>network drive is "mounted". I could use           something similar to that in 
>their .bashrc or write a little           script
>
>if [ ! -f ~/homework/.lock ]; then
>        /usr/bin/smbmount //ldap/username ./homework -o noperm
>fi
>
>That would be fine but one thing is they should not have to           open a 
>bash, type anything or double click something. The           reason is that they 
>will never synchronize their folder if           they have to do something. I 
>know, I know, they are academics           :)
>Then we would be held responsible for any loss or whatever           went 
wrong.
>
>If I put in fstab the mount instruction and they are not           connected to 
>the network, it will "freeze" until it times out.           Can be a pain and a 
>source of complaints. XP was better :(
>
>Basically what I am looking for as a solution is this:
>
>a) When the machine gets an ip from the network at work, their           network 
>drive should be automatically mounted. A mount point           will be created 
>on their default install.
>
>b) When the laptop gets an ip that is not from work, the           "mount 
>instruction" should immediately be ignored.
>
>c) If the machine is already up and running, but was not           connected to 
>the network, and they connect it to the network,           the drive should be 
>mounted automatically. At this point I           would be able to sync both 
>directories (local and network           "Documents"). I will use a cron job for 
>that. Maybe not the           best solution but I have limited knowledge, so I 
>use what I           know.
>
>I am thinking there might be a possibility to accomplish what           I 
>described above with pam_auth. If there are authenticated to           the 
>network, the drive is mounted, if not it is not mounted. I           am not sure 
>though if it can be done that way. I still have           some reading to do, 
>but before I continue, I would like to           know if 
>
>
>1) it's make sense to do it the way I described it
>
>2) if there is a better solution
>
>3) what people do in that situation.
>
Maybe there are better ways, but in the past I used to install     scripts in 
the /etc/network directory? This directory has 4     sub-directories, 
if-down.d,  if-post-down.d,  if-pre-up.d, and      if-up.d in which you can 
install scripts to be executed when the     network connection is brought up 
and/or down.  Also, if you use the     network manager then there is the 
directory     /etc/NetworkManager/dispatcher.d in which I used in the past to 
run     a script that detected network interface changes and acted upon.     
That may help you automate the process.

Avi


Thank you for the pointer, I will try the solution mentioned above. Yes I use 
NM.



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20110217/f153c08b/attachment.html>


More information about the ubuntu-users mailing list