Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Mar 2010 16:22:24 +0100
From:      Miroslav Lachman <000.fbsd@quip.cz>
To:        serena zanetta <sz3003@gmail.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Permission denied error
Message-ID:  <4B97B930.1040906@quip.cz>
In-Reply-To: <b2ecfd381003100651s774dd6dcy63c69008088ca826@mail.gmail.com>
References:  <b2ecfd381003100651s774dd6dcy63c69008088ca826@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
serena zanetta wrote:
> Hi,
>
> I’ve got a problem with the packet injection. I’ve tried to send a packet by
> the means of the nemesis suite. Everything works fine since I type the
> command
>
> “nemesis udp …”
>
> on the command line.
>
> If I tried to call the same command via the PHP exec()
>
> exec("nemesis udp $message_to_send",$response);
>
> the nemesis packet injection failed: “/dev/bpf0: Permission denied” !
>
> sprintf(device, "/dev/bpf%d", i);
>
> fd = open(device, O_RDWR);
>
> Gives  fd = -1.


Is your PHP script called as user root or www (via Apache)?

bpf device is usable only by root (be default) unless you change the 
permissions:

# ls -al /dev/bpf0
crw-------  1 root  wheel    0, 170 Aug 25  2009 /dev/bpf0

Miroslav Lachman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B97B930.1040906>