I assume that users A and B are using the same Linux machine(s) where you are the administrator.

The following command will prevent the user with uid 1234 from sending packets on the interface eth0:

# iptables -t mangle -A OUTPUT -o eth0 -m owner --uid-owner 1234 -j DROP

Thanks to this StackExchange thread.