Hi
Is there a way or a script i can add to the config file that will automatically mount a network drive
once openvpn has connected from a clients computer to the server?
Currently i have a script which they click on once the vpn is connected but would love to automate the whole
process.
Cheers,
Lucas
Automatically mount network drive when openvpn connects
Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech
-
- OpenVpn Newbie
- Posts: 3
- Joined: Tue Mar 08, 2011 4:18 am
- janjust
- Forum Team
- Posts: 2703
- Joined: Fri Aug 20, 2010 2:57 pm
- Location: Amsterdam
- Contact:
Re: Automatically mount network drive when openvpn connects
yes this is possible ; add a 'up' or 'route-up' script to the config which maps the drives in the background. If you're using the OpenVPN GUI it is also possible to create a GUI-specific post-connect script: if your openvpn configuration is named <config>.ovpn then place a script named <config>_up.bat in the same directory. This script will be executed after the openvpn tunnel turns "green".
-
- OpenVpn Newbie
- Posts: 3
- Joined: Tue Mar 08, 2011 4:18 am
Re: Automatically mount network drive when openvpn connects
Thanks for the help, i was able to get it to work with the <config>_up.bat
Would you have any examples you could point me in the right direction of
the --up and --route-up scripts included in the client config file.
Would you have any examples you could point me in the right direction of
the --up and --route-up scripts included in the client config file.
- janjust
- Forum Team
- Posts: 2703
- Joined: Fri Aug 20, 2010 2:57 pm
- Location: Amsterdam
- Contact:
Re: Automatically mount network drive when openvpn connects
a 'route-up' configuration in the client config file would look something like
or
In the first example the route-up.bat file must be present in the same directory as the openvpn config file (usually c:\program files\openvpn\config) ; in the second example the script must be present in c:\program files\openvpn\scripts
For Windows Vista/7 client it is sometimes useful to use
as you can avoid some privilege escalation problems with that , but this is considered less secure.
Code: Select all
script-security 2
route-up route-up.bat
Code: Select all
script-security 2
route-up ..\\scripts\\route-up.bat
For Windows Vista/7 client it is sometimes useful to use
Code: Select all
script-security 2 system
route-up ..\\scripts\\route-up.bat
-
- OpenVpn Newbie
- Posts: 3
- Joined: Tue Mar 08, 2011 4:18 am
Re: Automatically mount network drive when openvpn connects
perfect thanks again.