Search code examples
error-handlingterminalconnectionvpnopenvpn

Why does "~$ sudo openvpn ~/<file_name>.ovpn" give error?


I got a .ovpn file for work a couple of weeks ago and at first, everything worked correctly, it was running no problem. When I tried to use it again I got this error

<user>@<name>:~$ sudo openvpn ~/<file_name>.ovpn
Options error: In [CMD-LINE]:1: Error opening configuration file:
/home/<name>/<file_name>.ovpn
Use --help for more information.

So I tried openvpn --config <file_name>.ovpn and got this

<user>@<name>:~$ openvpn --config <file_name>.ovpn
Tue Feb  2 11:11:08 2021 OpenVPN 2.4.7 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Sep  5 2019
Tue Feb  2 11:11:08 2021 library versions: OpenSSL 1.1.1f  31 Mar 2020, LZO 2.10
Tue Feb  2 11:11:08 2021 WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.
Tue Feb  2 11:11:08 2021 TCP/UDP: Preserving recently used remote address: [AF_INET]65.175.70.209:1194
Tue Feb  2 11:11:08 2021 UDP link local: (not bound)
Tue Feb  2 11:11:08 2021 UDP link remote: [AF_INET]65.175.70.209:1194
Tue Feb  2 11:11:09 2021 [server] Peer Connection Initiated with [AF_INET]65.175.70.209:1194
Tue Feb  2 11:11:10 2021 ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)
Tue Feb  2 11:11:10 2021 Exiting due to fatal error

What can I do to fix this? Thanks in advance.


Solution

  • I was able to fix it using an --auth-retry and interact added onto the previous command:

    <user>@<name>:~$ sudo openvpn --config <file_name>.ovpn --auth-retry interact         
    Wed Feb  3 10:22:13 2021 OpenVPN 2.4.7 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Sep  5 2019
    Wed Feb  3 10:22:13 2021 library versions: OpenSSL 1.1.1f  31 Mar 2020, LZO 2.10
    Wed Feb  3 10:22:13 2021 WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.
    Wed Feb  3 10:22:13 2021 TCP/UDP: Preserving recently used remote address: [AF_INET]65.175.70.209:1194
    Wed Feb  3 10:22:13 2021 UDP link local: (not bound)
    Wed Feb  3 10:22:13 2021 UDP link remote: [AF_INET]65.175.70.209:1194
    Wed Feb  3 10:22:14 2021 [server] Peer Connection Initiated with [AF_INET]65.175.70.209:1194
    Wed Feb  3 10:22:15 2021 TUN/TAP device tun0 opened
    Wed Feb  3 10:22:15 2021 /sbin/ip link set dev tun0 up mtu 1500
    Wed Feb  3 10:22:16 2021 /sbin/ip addr add dev tun0 local 172.16.100.185 peer 172.16.100.186
    Wed Feb  3 10:22:16 2021 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
    Wed Feb  3 10:22:16 2021 Initialization Sequence Completed