471,330 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 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 3571
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Grant Edwards | last post: by
7 posts views Thread by Fazer | last post: by
2 posts views Thread by Erich Keane | last post: by
1 post views Thread by gz | last post: by
11 posts views Thread by gustavo.samour | last post: by
1 post views Thread by kavok | last post: by
reply views Thread by rosydwin | last post: by

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.