问题描述
我正在使用 IPVanish 在冲浪时使用代理;喜欢:
I am using IPVanish for using a proxy while surfing; like:
sudo openvpn --config /home/ipv/conf/ipvanish-CA-Toronto-tor-a09.ovpn
现在,我必须输入我的用户名,然后输入我的密码.如何将这两个参数作为一个命令传递,以便我只使用一个命令并且用户名/密码会自动传递?
Now, I have to enter my username, after that my password.How Can I pass those two params right as one command, so that I just use one command and the username/password are being passed automatically?
推荐答案
之前的答案对我不起作用(仍然要求输入用户名和密码),起作用的是将您的凭据放入文件中(pass.txt),像这样
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
[email protected]
password
并使用 --auth-user-pass pass.txt
调用 openvpn.
and calling openvpn with --auth-user-pass pass.txt
.
请注意,在某些 OpenVPN 版本(例如 OpenVPN 2.4.11)中存在一个错误,您必须先使用 --config
然后使用 --auth-user-pass
否则您的身份验证文件将被忽略而不会发出任何警告.
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
这篇关于Linux 上的 OpenVPN:在命令行中传递用户名和密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!