Quantcast
Channel: Active questions tagged openvpn - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 827

Bash Scripting - How to direct output to multiple inputs in OpenVPN?

$
0
0

So i'm trying to write a script to ease the process of connecting to OpenVPN server.

So when i write:

openvpn --config vpnbook-pl226-udp53.ovpn

It prompts me to type username and password:

Wed Apr  1 21:23:28 2020 OpenVPN 2.4.7 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Feb 20 2019Wed Apr  1 21:23:28 2020 library versions: OpenSSL 1.1.1d  10 Sep 2019, LZO 2.10Enter Auth Username:            Enter Auth Password: 

Here i want my script to automatically send username and password to OpenVPN.

I had the following attempts:

Attempt 1:

{ echo "vpnbook"; echo "3vze4vd"; } | openvpn --config vpnbook-pl226-udp53.ovpn

Attempt 2:

echo -e "vpnbook\n3vze4vd" | openvpn --config vpnbook-pl226-udp53.ovpn

Attempt 3:

(echo $username; echo $password;) | openvpn --config vpnbook-pl226-udp53.ovpn

But none of them are working, i'm getting the following output:

Wed Apr  1 21:38:14 2020 OpenVPN 2.4.7 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Feb 20 2019Wed Apr  1 21:38:14 2020 library versions: OpenSSL 1.1.1d  10 Sep 2019, LZO 2.10

Then nothing happens.

Can someone please give me a hint on this ?


Viewing all articles
Browse latest Browse all 827

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>