Fatal: can't open lock file /run/xtables.lock: Permission denied
Emily Wong
Have just subscribed for a VPN service and while I did notice that at times the connection drops, I looked around for ways to setup a kill-switch in Ubuntu. I did follow the instructions at but am getting the following issues: (My VPN is setup to OpenVPN)
when running sysctl -p I get the following output:
$ sudo sysctl -p net.ipv4.ip_forward = 1 net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1net.ipv6.conf.lo.disable_ipv6 = 1 sysctl: cannot stat /proc/sys/net/ipv6/conf/eth0/disable_ipv6: No such file or directorywhen it comes to flushing the current IP tables, I get the error:
Fatal: can't open lock file /run/xtables.lock: Permission deniedWould really appreciate some help on this, pls.
52 Answers
1) "No such file or directory" is easy to troubleshoot - just look in your own filesystem. In this case, it's not 'eth0'. It's your actual network connection (likely something like 'tun_' or 'enp___' or 'wlp___').
2) "Permission denied" is also an easy one - it means you forgot to use sudo.
"sudo iptables -F && iptables -X" should be "sudo iptables -F && sudo iptables -X". The second iptables (the -X one) won't be run as root otherwise and you'll have permission problems with the xtables.lock.
FYI the xtables thing is a common program called xtables-nft-multi that nowadays does various iptables function by looking at which name it was invoked under. It's not well thought of in some circles.