I want to create a new user (or group), so that any application running with this user can't connect to the network.
@Michael Kjörling I have followed your suggestion(with Ubuntu 12.04 64bit) and got some error information:
$ sudo iptables -A OUTPUT -m owner --uid-owner xyz ! -i lo -j REJECT --reject-with network-unreachable
iptables v1.4.12: unknown reject type "network-unreachable"
Try `iptables -h' or 'iptables --help' for more information.
$ sudo iptables -A OUTPUT -m owner --uid-owner xyz ! -i lo -j REJECT
iptables v1.4.12: Can't use -i with OUTPUT
Try `iptables -h' or 'iptables --help' for more information.
$ sudo iptables -A OUTPUT -m owner --uid-owner xyz ! -j REJECT
iptables v1.4.12: cannot have ! before -j
Try `iptables -h' or 'iptables --help' for more information.
Finally, the following one works. But I'm not sure if there is anything wrong.
$ sudo iptables -A OUTPUT -m owner --uid-owner xyz -j REJECT
$