image
image

Go Back   macosx.com > Mac Help Forums > Unix & X11

Reply
 
Thread Tools
  #1  
Old September 3rd, 2004, 09:38 AM
Registered User
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
guitarmy is on a distinguished road
Permanently grant read access to /dev/bpf*

Hi, I'm trying to use a packet capture library that uses the berkley packet filters in Darwin. In order to capture the packets, I must have read acess to the /dev/bpf* files. I can chmod these, but as soon as I reboot their privledges are reset! Any ideas?
Thanks,
Eric
Reply With Quote
  #2  
Old September 4th, 2004, 09:37 AM
Captain Code's Avatar
Moderator
 
Join Date: Aug 2001
Location: Ontario, Canada
Posts: 3,108
Thanks: 0
Thanked 1 Time in 1 Post
Captain Code will become famous soon enough
Assuming this is a command line packet sniffer, use sudo to run it instead.

Changing system directory permissions isn't a good idea.
__________________
MacBook Pro 2.16GHz Core2Duo 3GB RAM, G4 1.4GHz OSX Tiger 1.25GB RAM, Dual 2GHz G5 OSX Tiger 2GB RAM (freakin shweet)
Athlon 64 Windoze XP for school work (programming) 1GB RAM
dferns@macosx.com
Reply With Quote
  #3  
Old September 4th, 2004, 12:06 PM
davidbrit2's Avatar
Licensed Computer Geek
 
Join Date: Sep 2000
Location: Michigan, USA
Posts: 787
Thanks: 0
Thanked 0 Times in 0 Posts
davidbrit2 is on a distinguished road
To avoid using sudo every time, you can just enable the setuid bit on the application. Do this carefully though, because it means anybody who runs the program is running it with root permissions.

Okay, here's what you do: (most of it from the Terminal)

1. First, set the owner of the program to root. With the setuid bit enabled, the program is run with the permissions of the owner.
2. Set the group to admin (assuming you're an admin user). This way we can set it so only admin users have access to the program.
3. chmod 4750 programfilename

The chmod command alters the permission bits. In this case, here's what they represent.
4 - setuid bit enabled
7 - read, write, execute enabled for owner (root)
5 - read, execute enabled for group (admin)
0 - all other users have no access

This is how I usually do it for programs like tcpdump and tcpflow, and it works like a charm.
__________________
You can have my iBook when you pry it from my cold, dead fingers.
iBook - The computer of choice for the enlightened CS major. Come on Apple, let me do a commercial. ;-)
"An alloc a day keeps the DRAM away!"
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 10:14 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.