Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » running gdb as root without running eclipse as root
running gdb as root without running eclipse as root [message #187264] Wed, 07 March 2007 10:35 Go to next message
Eclipse UserFriend
Originally posted by: lambert_anne.club.lemonde.fr

Hi,

I am developing a small program that uses the libpcap library. For the
program to work I need to start it as root. By using setuid I managed to
have the program working when using the Run perspective but how do I get
the same with the debugger??
I tried adding an alias: gdb sudo gdb but when started with eclipse I am
still the owner of the process... If I try to start gdb outside of
Eclipse, no problem, owner is root.

Any idea?
Thanks for any help
Anne
Re: running gdb as root without running eclipse as root [message #187293 is a reply to message #187264] Thu, 08 March 2007 11:05 Go to previous messageGo to next message
Norbert Plött is currently offline Norbert PlöttFriend
Messages: 233
Registered: July 2009
Senior Member
Hi Anne,

you could try to wrap

sudo gdb $*

into a script and then specify the script as debugger instead of the "gdb"
default.


HTH


Norbert
Re: running gdb as root without running eclipse as root [message #187310 is a reply to message #187293] Thu, 08 March 2007 13:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lambert_anne.club.lemonde.fr

Unfortunately it does not work. Thanks for the help!
I get:

Exec Error: Cannot run ... gdb_root.sh

with gdb_root.sh =

#!/bin/bash
#
sudo gdb $*

Anyone as another idea?

Thanks,

Anne
Re: running gdb as root without running eclipse as root [message #187332 is a reply to message #187310] Thu, 08 March 2007 19:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brons_eclipsepost.rinspin.com

Anne Lambert wrote:
> Unfortunately it does not work. Thanks for the help!
> I get:
>
> Exec Error: Cannot run ... gdb_root.sh
>
> with gdb_root.sh =
> #!/bin/bash
> #
> sudo gdb $*
>
> Anyone as another idea?

Silly question... did you set executable permission on the script?
Re: running gdb as root without running eclipse as root [message #187340 is a reply to message #187310] Thu, 08 March 2007 19:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brons_eclipsepost.rinspin.com

Anne Lambert wrote:
> Unfortunately it does not work. Thanks for the help!
> I get:
>
> Exec Error: Cannot run ... gdb_root.sh
>
> with gdb_root.sh =
> #!/bin/bash
> #
> sudo gdb $*
>
> Anyone as another idea?

Silly question... did you set executable permisson on the script?
Re: running gdb as root without running eclipse as root [message #187369 is a reply to message #187340] Fri, 09 March 2007 07:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lambert_anne.club.lemonde.fr

Not a silly question at all... I tried so many different things in the
last few days, that I did not check that!
So yes with executable permission it does work!!

Thanks a lot for your help!

Anne
Re: running gdb as root without running eclipse as root [message #192790 is a reply to message #187369] Thu, 07 June 2007 07:07 Go to previous messageGo to next message
Hasan Ceylan is currently offline Hasan CeylanFriend
Messages: 54
Registered: July 2009
Member
Anne Lambert wrote:
> Not a silly question at all... I tried so many different things in the
> last few days, that I did not check that! So yes with executable
> permission it does work!!
>
> Thanks a lot for your help!
> Anne
>
>
I need help on this issue as well.

I get "Error creating session
sudo: sorry, you must have a tty to run sudo"

Is there a way I can work this around?

Ceylan
Re: running gdb as root without running eclipse as root [message #192881 is a reply to message #192790] Fri, 08 June 2007 08:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: J.Kilner.surrey.ac.uk

On Thu, 2007-06-07 at 10:07 +0300, Hasan Ceylan wrote:
> Anne Lambert wrote:
> > Not a silly question at all... I tried so many different things in the
> > last few days, that I did not check that! So yes with executable
> > permission it does work!!
> >
> > Thanks a lot for your help!
> > Anne
> >
> >
> I need help on this issue as well.
>
> I get "Error creating session
> sudo: sorry, you must have a tty to run sudo"
>
> Is there a way I can work this around?
>
> Ceylan

You might need one of the graphical versions of sudo. If you are using
kde try using kdesu , and if you are using gnome try gksu instead of the
sudo command.


Joe
Re: running gdb as root without running eclipse as root [message #193059 is a reply to message #192881] Tue, 12 June 2007 06:48 Go to previous messageGo to next message
Hasan Ceylan is currently offline Hasan CeylanFriend
Messages: 54
Registered: July 2009
Member
Joe Kilner wrote:
>>
>> Is there a way I can work this around?
>>
>> Ceylan
>
> You might need one of the graphical versions of sudo. If you are using
> kde try using kdesu , and if you are using gnome try gksu instead of the
> sudo command.
>
>
> Joe
>

Hello Joe,

Thanks for tip.

Now I understand what the problem is. Although I am using fedora/GNOME
and fedora does not seem to have gksu.

I will further investigate in the fedora forums.

Regards,
Hasan Ceylan
Re: running gdb as root without running eclipse as root [message #193067 is a reply to message #192881] Tue, 12 June 2007 07:52 Go to previous messageGo to next message
Hasan Ceylan is currently offline Hasan CeylanFriend
Messages: 54
Registered: July 2009
Member
Joe Kilner wrote:
> On Thu, 2007-06-07 at 10:07 +0300, Hasan Ceylan wrote:
>> Anne Lambert wrote:
>>> Not a silly question at all... I tried so many different things in the
>>> last few days, that I did not check that! So yes with executable
>>> permission it does work!!
>>>
>>> Thanks a lot for your help!
>>> Anne
>>>
>>>
>> I need help on this issue as well.
>>
>> I get "Error creating session
>> sudo: sorry, you must have a tty to run sudo"
>>
>> Is there a way I can work this around?
>>
>> Ceylan
>
> You might need one of the graphical versions of sudo. If you are using
> kde try using kdesu , and if you are using gnome try gksu instead of the
> sudo command.
>
>
> Joe
>

Here's another solution.
(I think) eclipse must be running as root as well to manipulate gdb

login as root
create a file called /etc/security/console.apps/eclipsesu

enter the information below

---------
USER=root
PROGRAM=/usr/bin/eclipse
SESSION=true
---------

create a file called /etc/pam.d/eclipsesu

enter the following informa below
----------
#%PAM-1.0
auth include config-util
account include config-util
session include config-util
----------
do
#ln -s /usr/bin/eclipse /usr/bin/eclipsesu

from gnome or kde run /usr/bin/eclipsesu

This will popup the root passwd screen. Then you are good to go.

Regards,
Hasan Ceylan
Re: running gdb as root without running eclipse as root [message #1011871 is a reply to message #193067] Wed, 20 February 2013 11:59 Go to previous message
Volodia 1 is currently offline Volodia 1Friend
Messages: 1
Registered: February 2013
Junior Member
Hi;

I'm having the same problem and tried the above solutions,
(setting debugger to sudo gdb, or to batch file running as gdb as root user)
but I keep getting an error message in Eclipse "Cannot run program" "unknown reason",
when trying to debug.

Please advise me what I'm doing wrong.
Previous Topic:Indexer with multiple projects
Next Topic:Eclipse-CDT and Makefiles
Goto Forum:
  


Current Time: Fri Apr 26 18:07:05 GMT 2024

Powered by FUDForum. Page generated in 0.04079 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top