Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-11-2009, 01:32 PM   #1
LQ Newbie
Registered: Oct 2008
Posts: 29

Rep: Reputation: 15
providing root priviledges through a C program with GTK based gui

Hello Everyone,
I am writing an application for internet configuration in FEDORA and thus need to manipulate files which have access granted only to root. Thus a user change needs to be done through "su" and then providing the password.

What I want to ask is, how can I do this? Because when I run the program through a normal user it reports bug and exits.
Old 06-11-2009, 02:26 PM   #2
Senior Member
Registered: Mar 2004
Location: england
Distribution: Debian, Mint, Puppy, Raspbian
Posts: 3,421

Rep: Reputation: 200Reputation: 200Reputation: 200
sounds like a bad idea,

what are you trying to do?
Old 06-12-2009, 02:22 AM   #3
LQ Newbie
Registered: Oct 2008
Posts: 29

Original Poster
Rep: Reputation: 15
Originally Posted by bigearsbilly View Post
sounds like a bad idea,

what are you trying to do?
I made a GTK based GUI tool for configuring network, thus network files need to be manipulated. But this can be done only as root. So the tool is to be executed through terminal as root but if if it is executed directly or say as normal user it reports bug and exits. What I want to do id make another GTK based dialog in the same tool which when executed first asks for root password and then provides root priviledges to itself, i.e., the step of switching to the root through the terminal is not to be done rather this is done when the app is executed.
Old 06-12-2009, 05:49 AM   #4
Registered: Oct 2008
Location: I live where I'm currently standing on
Distribution: fedora, opensuse
Posts: 34

Rep: Reputation: 17
PolicyKit? Look into it.
Old 06-12-2009, 08:03 AM   #5
Wim Sturkenboom
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Look at setuid (man 2 setuid).
Old 06-18-2009, 09:51 PM   #6
Registered: Jul 2005
Location: maryland
Distribution: Ubuntu 9.04
Posts: 88

Rep: Reputation: 17
no dude, your program is fine, but run it with gksudo, read this site i found with google:
Old 06-22-2009, 02:29 AM   #7
LQ Newbie
Registered: Oct 2008
Posts: 29

Original Poster
Rep: Reputation: 15
Thanks a lot. I hope it works this time.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question, QT, GTK ... is there any more language to program a GUI in linux??? webquinty Linux - Newbie 4 11-07-2008 02:04 PM
Is there any Gui Based Program in Linux as Task Manager in Windows sheraz Linux - Software 5 09-06-2007 06:57 PM
Problem with font size on gtk based program eduac Linux - Software 1 03-21-2006 01:38 PM
start gui based program after user login shahidawan Linux - General 9 07-27-2005 09:46 PM
Gtk gui on a cgi perl program bruce1271 Linux - Software 2 12-08-2003 06:54 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:40 AM.

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