manually run openVPN inside a screen terminal
Hi there,
I'm trying to create a script that runs in terminal is automatically started in a raspberry pi 'screen' output. The problem here is that i need sudo privileges inside the script, and that once the process is running I don't see the request for the password.
one example of how the script should run is the following:
1) go to a folder:2) execute the service (this requires sudo privileges):When I enter the code manually the script does run so there is no problem there, I just have a problem executing this inside a 'screen'
I've set up the following script using some googleing:This script should check if there is a screen called 'pia' and if not create a screen called pia and run the script.
It however does not seem to work, can anyone maybe suggest where I should go from here?
Thanx in advance.
I'm trying to create a script that runs in terminal is automatically started in a raspberry pi 'screen' output. The problem here is that i need sudo privileges inside the script, and that once the process is running I don't see the request for the password.
one example of how the script should run is the following:
1) go to a folder:
cd /etc/openvpnsudo openvpn ./pia_netherlands.confI've set up the following script using some googleing:
#!/bin/sh
if [ -z "$STY" ]; then exec screen -dm -S pia /bin/bash "$0"; fi
cd /etc/openvpn
sudo openvpn ./pia_netherlands.conf
It however does not seem to work, can anyone maybe suggest where I should go from here?
Thanx in advance.
Comments
Change it to
Then place a file called pass.txt in the same directory as the ovpn file which contains:
You could also try my script which does all this for you.
Cheers
On most recent Linux distros, you can drop the VPN configuration files directly in /etc/openvpn/client/, rename the one you want to use to .conf and just start/enable it as a system service With systemd that would be "sudo systemctl enable --now [email protected]", and that would automatically load up /etc/openvpn/client/pia.conf in OpenVPN for you.