Author Topic: Execute programs with sudo rights in ubuntu.  (Read 10844 times)

Offline lilezek

  • Single posting newcomer
  • *
  • Posts: 3
Execute programs with sudo rights in ubuntu.
« on: April 04, 2011, 04:07:29 pm »
Hi. I'm doing a program that needs super user rights to work. So I need to build it and then execute it as sudo user.

How could I execute a debugger within code::blocks with super user rights? Could this be done without execute code::blocks as super user?

Thank you.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Execute programs with sudo rights in ubuntu.
« Reply #1 on: April 04, 2011, 04:50:52 pm »
This http://forums.codeblocks.org/index.php/topic,9775.0.html like the only solution at the moment.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Execute programs with sudo rights in ubuntu.
« Reply #2 on: April 04, 2011, 08:11:35 pm »
This http://forums.codeblocks.org/index.php/topic,9775.0.html like the only solution at the moment.
Alternatively you can setup a script for gdb that actually calls sudo and queries for a PW in an intelligent way (not stopping C::B from work).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Execute programs with sudo rights in ubuntu.
« Reply #3 on: April 04, 2011, 08:57:01 pm »
A script probably won't work, because C::B needs the PID of GDB.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Execute programs with sudo rights in ubuntu.
« Reply #4 on: April 04, 2011, 10:17:34 pm »
A script probably won't work, because C::B needs the PID of GDB.
...true. :oops:
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline lilezek

  • Single posting newcomer
  • *
  • Posts: 3
Re: Execute programs with sudo rights in ubuntu.
« Reply #5 on: April 06, 2011, 03:24:57 pm »
This http://forums.codeblocks.org/index.php/topic,9775.0.html like the only solution at the moment.

Well, I already know that solution, that is why I asked a way to do it without sudo privileges. I don't like my source code or my the compiled objects to be owned by root user.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Execute programs with sudo rights in ubuntu.
« Reply #6 on: April 06, 2011, 03:34:19 pm »
Install windows then. There is no such restriction  :lol:
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Execute programs with sudo rights in ubuntu.
« Reply #7 on: April 06, 2011, 03:57:29 pm »
Install windows then. There is no such restriction  :lol:
There is something similar, as we often see, if users try to create exe's below win7's program-folder.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Execute programs with sudo rights in ubuntu.
« Reply #8 on: April 06, 2011, 05:23:51 pm »
I should have left it win98...  :lol:
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline lilezek

  • Single posting newcomer
  • *
  • Posts: 3
Re: Execute programs with sudo rights in ubuntu.
« Reply #9 on: April 06, 2011, 06:07:38 pm »
Install windows then. There is no such restriction  :lol:

No restriction for reading memory with ReadProcessMemory and WriteProcessMemory? It sounds security hazard.