How do I block a user from accessing the internet under Linux?
I'm trying the following:
iptables -A OUTPUT -p tcp --dport 80,443 -m owner --uid-owner $USERNAME -j DROP
Is that the right syntax or command?
This command will only block the user from accessing the World Wide Web, not the entire Internet.
Apart from that it should work, assuming it is run on the same machine
And then I do
In other words, blacklisting specific ports is not sufficient; you may want to block all network access:
Note that there may be a need to access certain network resources (e.g. local network shares), so you may need to whitelist those (or perhaps whitelist the local network block).