News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Help Running/Debugging "root" programs

Started by michelinok, August 23, 2008, 10:28:24 AM

Previous topic - Next topic

michelinok

Hi there!
I'm new to C and codeblocks, but i find codeblocks excellent!
I've s "simple" question.... my program needs to be run/debugged as root, but i'm developing as a normal user; is there a way to run/debug as root inside codeblocks? (something like "when run/debug" ask for root password and proceed).

Many thanks!
Great job!

Barking_Mad

Just change the terminal/shell to a root/admin one in the environment options of CB. Its in the general options section.
WooF! WooF! - Ubuntu 8.10 & CB 5432 & GCC 4.3.2
To see the world in a grain of sand and heaven in a wild flower
To hold infinity in the palm of your hand and eternity in an hour - W.B

michelinok

Quote from: Barking_Mad on August 29, 2008, 07:21:13 AM
Just change the terminal/shell to a root/admin one in the environment options of CB. Its in the general options section.
Ok, found the 2 entryes:

Shell to run commands in:                        /bin/sh -c
Terminal to launch console programs:     xterm -T %TITLE -e

How should i change those entryes?

(I'm a newbie,sorry for the stupid question!)

Jenna

Quote from: michelinok on August 23, 2008, 10:28:24 AM
Hi there!
I'm new to C and codeblocks, but i find codeblocks excellent!
I've s "simple" question.... my program needs to be run/debugged as root, but i'm developing as a normal user; is there a way to run/debug as root inside codeblocks? (something like "when run/debug" ask for root password and proceed).

Many thanks!
Great job!


Afaik there is no option included in C::B.

You can try to start C::B from a console window with "sudo codeblocks" .

dmoore

maybe you should use a chroot/fakeroot/scratchbox approach...
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

michelinok

Quote from: dmoore on August 29, 2008, 05:02:10 PM
maybe you should use a chroot/fakeroot/scratchbox approach...

Please,can you explain what you mean?

dmoore

ideally you should try to avoid testing/debugging code as the root user on your system, as bad things could happen to the system leaving you up the proverbial creek without a paddle. chroot/fakeroot allow you to create a "fake" file system that looks like the real thing to the application. scratchbox goes one step further and lets you fake entire platforms, which allows you to test code for embedded systems (mobile phones, settop boxes etc) without having the hardware. the tools can even support gui apps using utils such as Xephyr. google any of these for more info. can you gives us more info about the sort of app you are trying to test/debug?
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

michelinok

Quote from: dmoore on August 29, 2008, 07:47:30 PM
ideally you should try to avoid testing/debugging code as the root user on your system, as bad things could happen to the system leaving you up the proverbial creek without a paddle. chroot/fakeroot allow you to create a "fake" file system that looks like the real thing to the application. scratchbox goes one step further and lets you fake entire platforms, which allows you to test code for embedded systems (mobile phones, settop boxes etc) without having the hardware. the tools can even support gui apps using utils such as Xephyr. google any of these for more info. can you gives us more info about the sort of app you are trying to test/debug?

yes, i need only to perform iwconfig,ifconfig and use the printk function.
That's all! (it's just an AP hopper, if someone is interested, i'm gonna publish my work on sourceforge very soon!).

wwwnuwan

yes. start codeblocks with sudo in terminal. it works