LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-18-2008, 08:02 AM   #1
Tomás Ó hÉilidhe
LQ Newbie
 
Registered: Feb 2008
Location: Southeast Asia (sunny!)
Distribution: Xubuntu
Posts: 28

Rep: Reputation: 15
Allow user to open raw socket without "sudo"


I'm currently writing a C program that opens a raw Ethernet socket. When I run it at the commandline, I have to do "sudo", as follows:

sudo ./inp

I'm using the Code::Blocks IDE and I want to be able to use the debugging facilities in Code::Blocks. However, I'm having a problem with having to run the debugger as root; the debugger won't play fair with the IDE because the IDE is run as "toe" and the debugger is run as "root".

Is there anything I can do to make it so that I can open a raw socket without having to do "sudo"?

Of course, I realise I could run Code::Blocks as root, but I don't want to do that. Being able to do away with "sudo" for opening raw sockets would save the day. (Of course I wouldn't leave my system like that 24/7, I'd just use it for debugging my program).
 
Old 12-18-2008, 01:53 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
The kernel will not allow sending of packets that cannot be trusted, and since your raw ethernet packets do not originate in a trusted stack, they require root privileges. No way around it, I'm afraid. If there were, it would be an easily exploitable security vulnerability.

--- rod.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot "sudo apt-get uptate" or "sudo" anything! plz help mdguy21061 Linux - Newbie 7 04-13-2008 11:59 PM
sudo: "user not allowed to execute" jjonas Linux - Security 6 07-05-2007 05:46 AM
"sudo -u user ssh server" fails to connect oudoubah Linux - Security 3 06-21-2007 06:45 AM
normal user want to perform "init 6" by using " sudo acbenny Linux - General 3 08-08-2004 07:41 AM
Apollon All-In-One-Installer Problem: "Could not open network socket"?? Darkstar274 Linux - Software 7 02-12-2004 02:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration