From owner-freebsd-net@FreeBSD.ORG Wed Mar 10 15:22:29 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 485AA1065674 for ; Wed, 10 Mar 2010 15:22:29 +0000 (UTC) (envelope-from 000.fbsd@quip.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) by mx1.freebsd.org (Postfix) with ESMTP id 01E058FC14 for ; Wed, 10 Mar 2010 15:22:28 +0000 (UTC) Received: from elsa.codelab.cz (localhost.codelab.cz [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id 7EB5419E027; Wed, 10 Mar 2010 16:22:27 +0100 (CET) Received: from [192.168.1.2] (r5bb235.net.upc.cz [86.49.61.235]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id 4588519E02D; Wed, 10 Mar 2010 16:22:25 +0100 (CET) Message-ID: <4B97B930.1040906@quip.cz> Date: Wed, 10 Mar 2010 16:22:24 +0100 From: Miroslav Lachman <000.fbsd@quip.cz> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1.8) Gecko/20100205 SeaMonkey/2.0.3 MIME-Version: 1.0 To: serena zanetta References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Cc: freebsd-net@freebsd.org Subject: Re: Permission denied error X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2010 15:22:29 -0000 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