0

I have an Ubuntu 14.04 Server with an OpenVPN Server running on it.

I would like to have an OpenVPN client from this machine connect to a remote machine in order to save backup files on the remote machine.

I already read that it is possible to have server and client and I have config and certificate files for the client in a folder seperate from the normal openvpn folder.

The big problem is that the Backup-User has no root priviledges and is not supposed to receive any either. As a result this user cannot create a VPN connection.

The OpenVPN client connection should only be active when needed, so I can't just activate it and leave it be. Is there maybe a way to start the VPN client connection automatically at a certain time and same with closing the connection?

2 Answers2

1

One way to solve your problem might be to use a cronjob. Run crontab with the command crontab -eand insert your command and the desired timing. To run a job at a certain time as root, just run sudo crontab -e when creating the rule. Rules follow the following scheme:

minute hour day month weekdays yourbashcommandhere

For example, if you wanted to run the job every wednesday at 10am, your rule should look like this:

* 10 * * 3 yourbashcommand

More info on timing options can be found here: http://www.adminschoice.com/crontab-quick-reference

Gasp0de
  • 464
-1

You can either run crontab scedule a certain command Sudo crontab -e Then edit it like this

Minutes hour day month weekday

To connect to openvpn server at every mondat 9 am

* 9 * * 1   openvpn --config server.ovpn

Or use at its easier but it works once untill you set it again

Sudo apt-get install at
at 09:00
"Your commands press enter for multiple commands and ctrl+d to apply the job"

atq 
"To see sceduled jobs"

atrm "jobnumber to delete the job"