473,372 Members | 947 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,372 software developers and data experts.

low level ethernet device access in linux


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

Aug 31 '07 #1
1 3685
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?

According to the raw(7) man page:


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

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. ...
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...
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...
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...
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...
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...
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...
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...
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...
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.