473,398 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

low level ethernet device access in linux

Hi,

I have a windows application, written in delphi, that communicates to our
devices using raw ethernet frames. I am trying to port this application to
linux using python. However, when I try to open a socket, I get this error:

File "/home/tbrown/projects/discovery/trunk/comm.py", line 9, in __init__
self.s = socket(AF_PACKET, SOCK_RAW, proto)
File "/usr/local/lib/python2.5/socket.py", line 156, in __init__
_sock = _realsocket(family, type, proto)
socket.error: (1, 'Operation not permitted')

I understand that I am getting this error because I am running the application
as a user and not as root. I would like to be able to run this app. as a
user. Is there a way to create a socket without running the app. as root or
sudo? When I run the app. as root I get this error:

discovery.py: cannot connect to X server

Thanks,
Tom
Aug 31 '07 #1
1 3688
On 2007-08-31, Tom Brown <br***@esteem.comwrote:
I understand that I am getting this error because I am running
the application as a user and not as root. I would like to be
able to run this app. as a user. Is there a way to create a
socket without running the app. as root or sudo?
Yes.

According to the raw(7) man page:

ERRORS

EPERM The user doesn't have permission to open raw
sockets. Only pro- cesses with a effective user
ID of 0 or the CAP_NET_RAW attribute may do that.

Anticipating your next question:

$ man capabilities

--
Grant Edwards grante Yow! Well, I'm INVISIBLE
at AGAIN ... I might as well
visi.com pay a visit to the LADIES
ROOM ...
Aug 31 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Grant Edwards | last post by:
How does one do raw Ethernet under Win32? Ultimately, I want to do it in a Python program, but if somebody can point me to a clue on how to do it from C, I could probably figure out the rest. ...
7
by: Fazer | last post by:
Hello, I have a MP3 and I want to access the songs in them. I was wondering if Python could help me do that. I understand that this can be done using Linux by mountig it as a file system, but...
2
by: Erich Keane | last post by:
Ok, first a quick background: I, along with a small group of diehards came up with a way to disable the EU volume cap protection on the european ipods. Unfortunately, this way never caught on, as...
1
by: gz | last post by:
Hi! I wanted to use python to test a simple character device (on linux) and I'm running into strange behaviour of read.. I have a short buffer inside my device and the idea is that it blocks...
2
ronnil
by: ronnil | last post by:
Hi First of all, let me say that I'm fairly new to Linux. My problem is that I'm not entirely able to uninstall windows partially because I need to debug webpages in MSIE. So what i would like...
11
by: gustavo.samour | last post by:
Hi, I am writing a very basic raw ethernet sniffer based on what I found in Andreas Schaufler's raw ethernet article: http://aschauf.landshut.org/fh/linux/udp_vs_raw/ch01s03.html I'm trying...
2
by: mostafijur | last post by:
Hello My PC has 2 ethernet card.I am using 1 port for internet.The 2nd port is connected with another PC and same network address.I want to send data by the 2nd port to that PC on time...
1
by: kavok | last post by:
I am writing a software that needs to sniff packets in the network (raw ethernet) and also, with another thread send regular UDP packets with the common socket API's. However, when the RAW...
1
by: Concepts Systems | last post by:
Hello All, Kernel Programming is the key to the digital city of device drivers: If you know the language for drivers you can get a device to do almost anything you want. Learn how to write...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.