LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-04-2012, 06:24 AM   #1
riahc3
Member
 
Registered: Dec 2002
Posts: 223

Rep: Reputation: 1
Make OpenVPN connect on Ubuntu startup and then when connected, run a script as su


Hey (That title was a mouthful)

I want that OpenVPN makes a connection when Ubuntu starts up and when the connection is up and running, to run a small script as su(peruser) without any user intervention.

How can I acomplish this?

Thank you
 
Old 10-04-2012, 11:38 PM   #2
nugat
Member
 
Registered: Sep 2012
Posts: 122

Rep: Reputation: 31
Quote:
Originally Posted by riahc3 View Post
I want that OpenVPN makes a connection when Ubuntu starts up and when the connection is up and running, to run a small script as su(peruser) without any user intervention.
Configure the openvpn daemon to autostart - how to do that varies from distro to distro, but it is usually a SysVInit symlink or upstart or systemd command.

Make sure that you've generated a pre-shared key that both sides of the vpn connection will use. configure the openvpn config file to use the keys and to use ip addresses to talk to each other.

to run a script w/superuser privileges, just run it as root. create a script in /etc/init.d/ and configure it to start after your openvpn connection is up.
 
Old 10-05-2012, 01:57 AM   #3
riahc3
Member
 
Registered: Dec 2002
Posts: 223

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by nugat View Post
Configure the openvpn daemon to autostart - how to do that varies from distro to distro, but it is usually a SysVInit symlink or upstart or systemd command.

Make sure that you've generated a pre-shared key that both sides of the vpn connection will use. configure the openvpn config file to use the keys and to use ip addresses to talk to each other.

to run a script w/superuser privileges, just run it as root. create a script in /etc/init.d/ and configure it to start after your openvpn connection is up.
Im in a Ubuntu distro 12.04 and Im using the network-manager-openvpn to configure it all.

I dont use preshared keys; Im using certified based OpenVPN connections......

Yes I imagine thats the way to do it but how do I configure it to start after my OpenVPN connection is up??
 
Old 10-05-2012, 09:01 PM   #4
nugat
Member
 
Registered: Sep 2012
Posts: 122

Rep: Reputation: 31
Quote:
Originally Posted by riahc3 View Post
Im in a Ubuntu distro 12.04 and Im using the network-manager-openvpn to configure it all.
i'm not familiar w/network-manager-openvpn... is it a start-up script, or a GUI tool, or what?

Quote:
I dont use preshared keys; Im using certified based OpenVPN connections......
okay, that part shouldn't matter, so long as it is file-based, and not something that requires user intervention.

Quote:
Yes I imagine thats the way to do it but how do I configure it to start after my OpenVPN connection is up??
that goes back to how openvpn starts when Ubuntu comes online, if it can be auto-started that is. i assume it can using Ubuntu's boot process - i thought it was upstart. perhaps the following thread will help:

http://ubuntuforums.org/showthread.php?t=1609579
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run script automatically when mouse is connected/disconnected? layr Linux - General 1 02-13-2012 09:41 AM
Script run at startup doesn't work under Ubuntu 10.04 LTS DSchuler Linux - Newbie 6 05-03-2011 07:42 PM
UBUNTU: can I run startup script only (not on shutdown)? fopetesl Linux - Software 8 06-10-2010 03:16 AM
OpenVPN client has not default gateway when connect to OpenVPN server sailershen Linux - Security 3 03-04-2010 02:20 AM
make script run on startup pytheas22 Fedora 1 11-08-2006 10:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration