Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Linux and Unix
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry router security slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
root permission in a C program

Reply  
Thread Tools
Gregg_e's Avatar
Junior Member with 3 posts.
 
Join Date: Aug 2003
04-Aug-2003, 02:22 PM #1
root permission in a C program
hey, i was wonder if anyone knows how to enable root permission to execute a segment of code which needs root access. The code is as follows

if (kill(pid,SIGKILL) != 0) {
g_warning ("Could not signal cardmgr");
}

The kill function is what needs the root permission. HElp..
codejockey's Avatar
Senior Member with 1,410 posts.
 
Join Date: Feb 2002
05-Aug-2003, 04:29 AM #2
There are a couple of possibilities right off the bat:

(1) execute the program as root.
(2) set the program to be setuid root (dangerous, but fairly common).

Note that what you are trying to do is to stop a process that you do not own, which is a security breach. Of course, sometimes there are good reasons to bend the security a bit.

Hope this helps.
__________________
The slowest component still sits at the keyboard.
Gregg_e's Avatar
Junior Member with 3 posts.
 
Join Date: Aug 2003
05-Aug-2003, 07:59 PM #3
Pcmcia cardmgr request eject Question
Ok, well I realized that I did not want to actually kill the cardmgr i simply want to request a card eject signal but this still requires root access. Is there someway I can prompt the user to enter the root password to allow the eject request to be sent as a root process?

this function that i will theoretically make, would catch the signal request response to prompt the user for tht root password and allow the request to be a root process instead.

i have also enclosed a pic of the beta program.

PS. I would hope that there is a function (s) in C that will allow me to do so.
Attached Thumbnails
root permission in a C program-applet_right_click.jpg  
twill's Avatar
Member with 44 posts.
 
Join Date: Jul 2003
Location: IA-US
06-Aug-2003, 02:35 AM #4
Well, you can just stop the pcmcia service by this command set:
service pcmcia stop
<remove card>
service pcmcia start
<the second is to restart the second card if there>

you should be able to set up permissions to allow service pcmcia to be started and stopped by regular users. I have to admit that I'm not sure how right off the top of my head because I don't have linux on a laptop.
__________________
I'm kinda like a superhero with no powers or motivation.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 10:54 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.