0

Hello I'm trying to access openvpn from ubuntu command line by trying to enter the sudo password and the username and password for openvpn altogether based on those answers:

sudo password from command line:

Use sudo with password as parameter

openvpn username and password from command line:

linux: passing username and password in command line

This is the command I'm entering:

echo 12345 | sudo -S openvpn <openvpnpath> --auth-user-pass pass.txt

Where inside pass.txt I have:

a@gmail.com

56789

But I'm getting the following error:

Options error: I'm trying to parse "/etc/openvpn..." as an --option parameter but I don't see a leading '--' Use --help for more information.

Am I missing something? Thnks!

alex
  • 335
  • 6
  • 17

2 Answers2

1

Did you try --config? Just:

echo 12345 | sudo -S openvpn --config /path/to/config.file --auth-user-pass pass.txt
lojza
  • 1,823
  • 2
  • 13
  • 23
  • I'm trying to use a specific file if I remove it I won't be able to do it. That's why I must specify the path – alex May 14 '19 at 14:32
-1

you can add your credentials, to configuration file

  1. Edit your .ovpn file

    vi <filename>.ovpn

  2. replace auth-user-pass to auth-user-pass < credentials_file.txt >

    auth-user-pass < credentials_file.txt >

    client
    dev tun
    proto udp
    ; Cert
    ns-cert-type server
    cipher BF-CBC
    ;Host
    resolv-retry infinite
    ;auth
    auth-user-pass "C:\\Program\\OpenVPN\\config\\selogin.txt"

    remote xxxxxxxxxxxxx
    persist-key
    persist-tun
    nobind
    comp-lzo
    verb 2
    <ca>
    -----BEGIN CERTIFICATE-----
    xxxx
    -----END CERTIFICATE-----
    </ca>
  1. connect to vpn

    sudo openvpn <openvpnpath>

mohan mu
  • 73
  • 1
  • 4