It is necessary to make a limit on the count. occupied ports, like the port itself.

For example, user test, assign port 2556, and he can run programs only on it.

Thank!

  • Looking towards quota, ulimit, rlimit? - 0andriy
  • @ 0andriy, No, but after a little inspection, the solution to the problem is not very visible. - Anastasia Safonova

1 answer 1

For example, user test, assign port 2556, and he can run programs only on it.

You can, for example, make it with iptables means something like this:

 iptables -A OUTPUT -m owner --uid-owner user -p tcp --dport 2556 -j ACCEPT iptables -A OUTPUT -m owner --uid-owner user -j REJECT 

And similarly for the INPUT chain.

This will not prevent user applications from opening other ports, but packets on them will be blocked.