Page 1 of 1

Auto Mount Network Share Ubuntu

Posted: Thu Dec 01, 2011 12:59 pm
by arturusch
Hello,

I have searched for this issue for a month. there are 100eds of solutions and since I am not really that good I dont know really what suites best. Is it a script? Is it routing issue, I dont know.

Nevertheles what I want is when I start my openvpn connection on my linux box via network-manager I map my drives on my work-windows machine.

This is surely very easy but with so many solutions on the net and all tried I am getting a bit desperate understanding what is what.

Right now as I mentioned above I connect to my work via OpenVPN via network-manager in Ubuntu. Then I manually mount:

Code: Select all

mount -t cifs //network/share /my/mountpoint username=winuser,password=winpass
.
I do it manually.

So, is there a way for me for those work directories to pop up?
Do I need a mounting auto-script?
Is it done via network-manager via routing?
Is it a bash script that I need to put in init.d directories?
Is it an autofs thing?

If automounting I need my system to unmount as well upon disconnecting VPN or logging out or shutting down otherwise the system stalls.

Bleh, I ran into so many solutions that my head is spinning. So I need a bit of help.
Thank you.

Re: Auto Mount Network Share Ubuntu

Posted: Thu Dec 01, 2011 1:29 pm
by maikcat
hi there,

you can create a script mounting or umounting your cifs share and
use it inside openvpn config using up and down directives..


Michael.

Re: Auto Mount Network Share Ubuntu

Posted: Thu Dec 01, 2011 2:01 pm
by janjust
what does work? can you access the share at all after the VPN has come up? can you even ping the server? can you access the share using the IP address (e.g. //a.b.c.d//...) ?

Re: Auto Mount Network Share Ubuntu

Posted: Thu Dec 01, 2011 2:15 pm
by arturusch
Hello Sir,

I can access the share after connection after mounting it manually like so.

Code: Select all

mount -t cifs -o username=winuser,password=winpass //10.1.1.22/workshareshare /media/work

Re: Auto Mount Network Share Ubuntu

Posted: Thu Dec 01, 2011 2:31 pm
by janjust
if you want this to happen automagically then write a NetworkManager dispatcher script which does just that and stick it in
/etc/NetworkManager/dispatcher.d

Be careful to check the arguments with which the script is called to ensure that you're mounting (and unmounting) the drive only when the tunnel comes up (and goes down).

Re: Auto Mount Network Share Ubuntu

Posted: Thu Dec 01, 2011 2:36 pm
by arturusch
Okay thanks,

I can not script but I can find some solution on the web I guess.
At least now I know what to look for,