0

Is it normal that you have to be a root user to connect to OpenVPN client because when I am not a root user this message appears and it fails to connect:

Tue Dec 11 03:04:31 2018 ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1) Tue Dec 11 03:04:31 2018 Exiting due to fatal error

But when I am a root user it connects just fine. And is it safe to connect to a VPN client with root privileges?

I don't know if this is normal or not. Pardon me for my ignorance on this subject matter.

Regards, pole.

1 Answer 1

0

OpenVPN tries to creates TUN/TAPdevices as needed, and only the root user can do this

You could use sudo to run it by editing the sudoers file, to allow an usergroup like vpnusers to start OpenVPN without password

You can add the following line to the file

%vpnusers ALL = NOPASSWD: /path/to/openvpn /path/to/openvpn.conf

I recommend you better to follow the instructions from the OpenVPN wiki, it shows you how you could run it as an user

By default, OpenVPN runs as the root user. This page seeks to describe how to instead run as an unprivileged user, "openvpn", instead. This is more secure than the built-in directives(--user and --group) because the openvpn process is never started with root permissions. Additionally, reconnects(including those which push fresh routes and configuration changes) which normally break after privileges are dropped via --user are handled without issue.

https://community.openvpn.net/openvpn/wiki/UnprivilegedUser

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.