Currently, I must sudo tcpflow -i lo as root user, I want to grant the lo interface and TCP port range 3000-3999 of all interfaces to user1, how to do that?
| |||
|
feedback
|
|
You need to be root to do the kind of snooping that tcpflow and tcpdump do. So you either need Well, technically all you need the You can use I don't think you'll be decently able to allow the user to specify an expression to match packets. Rather than give extra permissions to run Now for
For other interfaces, I think the following command selects tcp ports 3000–3999 (but make extensive tests to be sure):
Replace 1.2.3.4 by the IP address associated with the interface. I don't have a good solution to offer if the IP address isn't fixed: if you read it from My recommendation for a wrapper is not to use a shell script (I don't know if any of the shells in Debian is suitable for writing setuid scripts — shells tend to use a lot of environment variables), but rather Perl (where this kind of thing is explicitly supported), like this:
Make the script an ordinary executable (mode 755), and allow user1 to run it through sudo. ¹
For other Linux distributions: you need kernel 2.6.24 or above and the | |||
|
feedback
|
