OpenVPN on Linux: passing username and password in command line
The previous answer didn't work for me (still asked for username and password), what did work was putting your credentials in a file (pass.txt), like this
username@email.com
password
and calling openvpn with --auth-user-pass pass.txt
.
source
Note that in some OpenVPN versions (e.g. OpenVPN 2.4.11) there is a bug where you have to first use --config
and then --auth-user-pass
or your auth file will be ignored without any warning.
So, here a complete example:
sudo openvpn --config /home/ipv/conf/ipvanish-CA-Toronto-tor-a09.ovpn --auth-user-pass pass.txt
Openvpn leading -- error parse from txt username and password
Did you try --config
? Just:
echo 12345 | sudo -S openvpn --config /path/to/config.file --auth-user-pass pass.txt
Openvpn with username and password
There's a directive you can use in your server.conf
, depending on your OpenVPN version.
client-cert-not-required:
Makes your VPN a less secure as the cert is not required to authenticate (deprecated).
verify-client-cert none|optional|require:
Using verify-client-cert none is the equivalent of the aforementioned option.
Source Link: Click here
How can I pipe a username and password into another command that will execute (BASH)?
You can have local-exec
create a username / password file if you're using vault or something else to grab the credentials on the fly. Then provide the --auth-user-pass up
argument to read the file, then have local-exec
remove the file.
--auth-user-pass [up]
Authenticate with server using username/password. up is a file containing username/password on 2 lines. If the password line is missing, OpenVPN will prompt for one.
If up is omitted, username/password will be prompted from the console.The server configuration must specify an --auth-user-pass-verify script to verify the username/password provided by the client.
Source: https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
Related Topics
Identifying Which Linux System Library Contains a Function
How to Fix "Go Not Root Owned"
How to Force Cp to Overwrite Without Confirmation
Is Stack Memory Contiguous Physically in Linux
Linux. Sol_Netlink Not Defined
Remove File Coding Mark But Preserve Its Coding
Using Ld_Preload Mixed 64Bit/32Bit Environment in Linux
How to Count the Number of Occurrences of a String in an Entire File
How to Use Global Arrays in Bash
Cmake Auto Header File Dependency
Tiny "Manually" Created Elf Giving Segmentation Fault
About the Memory Layout of Programs in Linux
How to Build an App for an Old Linux Distribution, and Avoid the Fatal: Kernel Too Old Error
Ldconfig Error:"Is Not a Symbolic Link" When Using Linux Loader
How to Parse Command Line Options in Bash Shell