Configure tcpdump to work as non-root user on CentOS

General support questions
Post Reply
bojankikrick
Posts: 1
Joined: 2014/04/15 18:08:25

Configure tcpdump to work as non-root user on CentOS

Post by bojankikrick » 2014/04/15 18:14:59

Hi all !
I want to configure tcpdump to work as non-root user on CentOS
ex: test.c
‪#‎include‬ <stdio.h>
#include <pcap.h>
int main(int argc, char *argv[])
{
char *dev, errbuf[PCAP_ERRBUF_SIZE];
dev = pcap_lookupdev(errbuf);
if (dev == NULL) {
fprintf(stderr, "Couldn't find default device: %s\n", errbuf);
return(2);
}
printf("Device: %s\n", dev);
return(0);
}
compile: gcc -o test test.c -lpcap
-----------------------------------------------------------
It can't run with non-root user.
Then, I set up
$groupadd tcpdump
$addgroup <username> tcpdump
$chown root.tcpdump /usr/sbin/tcpdump
$chmod 0750 tcpdump
$setcap "CAP_NET_RAW+eip" /usr/sbin/tcpdump


But It does not run.
I want to run with non-root user on CentOS. I run on CentOS 6.4
Please help me ! thanks all....

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Configure tcpdump to work as non-root user on CentOS

Post by TrevorH » 2014/04/16 02:30:04

The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply