Issue
I got this function in a bash script:
function start_vpn() {
sudo ip netns exec frootvpn openvpn --config /etc/openvpn/frootvpn.conf &
while ! sudo ip netns exec frootvpn ip a show dev tun0 up; do
sleep .5
done
}
It fails because it doesn't stop to let me enter the private key password.
When I enter sudo ip netns exec frootvpn openvpn --config /etc/openvpn/frootvpn.conf
manually I got the private key prompt but in the script it doesn't wait for me to enter it :)
Solution
If you mean the sudo password you can try
sudo sh -c 'ip netns exec frootvpn openvpn --config /etc/openvpn/frootvpn.conf &'
For the openvpn password you could try asking it to read it from a fifo. You would then echo your password into the fifo. I havent tried this.
mkfifo ~/myfifo
sudo sh -c 'ip ... openvpn --askpass ~/myfifo ... &'
Then interactively, if you dont want your password echoed:
$ stty -echo; cat >~/myfifo; stty echo
type your password
type control-D for eof
Answered By - meuh Answer Checked By - David Goodson (WPSolving Volunteer)