Auto Mount Network Share Ubuntu

How to customize and extend your OpenVPN installation.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
arturusch
OpenVpn Newbie
Posts: 3
Joined: Thu Dec 01, 2011 12:27 pm

Auto Mount Network Share Ubuntu

Post by arturusch » Thu Dec 01, 2011 12:59 pm

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.

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Auto Mount Network Share Ubuntu

Post by maikcat » Thu Dec 01, 2011 1:29 pm

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.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: Auto Mount Network Share Ubuntu

Post by janjust » Thu Dec 01, 2011 2:01 pm

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//...) ?

arturusch
OpenVpn Newbie
Posts: 3
Joined: Thu Dec 01, 2011 12:27 pm

Re: Auto Mount Network Share Ubuntu

Post by arturusch » Thu Dec 01, 2011 2:15 pm

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

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: Auto Mount Network Share Ubuntu

Post by janjust » Thu Dec 01, 2011 2:31 pm

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).

arturusch
OpenVpn Newbie
Posts: 3
Joined: Thu Dec 01, 2011 12:27 pm

Re: Auto Mount Network Share Ubuntu

Post by arturusch » Thu Dec 01, 2011 2:36 pm

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,

Post Reply