[SOLVED] Super user as child process

This forum is dedicated to advanced help and support :

Ask here your questions about advanced usage of Mageia. For example you may post here all your questions about network and automated installs, complex server configurations, kernel tuning, creating your own Mageia mirrors, and all tasks likely to be touchy even for skilled users.

[SOLVED] Super user as child process

Postby Max » May 30th, '13, 18:58

I am preparing a computer to run Mga3 for a person who has an irrational fear of the terminal. Rather than waste my time arguing with him I will simply provide solutions.
The software that he needs to run Gmorgan, for some reason needs su privileges to use some ALSA libs (I think).
Anyway, my plan is to write a simple c program that will go to su, prompt him for a password, then start gmorgan as su.
However, here's the problem.
When I do
Code: Select all
if (fork()==0)
    execp("su");

then I lose control of the child process.
Is there a way for me to get su privileges from the user? Maybe by using a KDE window?
Last edited by Max on May 31st, '13, 16:14, edited 1 time in total.
Image
User avatar
Max
 
Posts: 269
Joined: Apr 4th, '11, 09:16

Re: Super user as child process

Postby doktor5000 » May 30th, '13, 21:28

Uhmm, why write a C program for that? Either use kdesu or create a custom launcher and start it under a different user ...
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18018
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Super user as child process

Postby Max » May 31st, '13, 16:13

Thanks, I knew there was a simpler way to do it.
Image
User avatar
Max
 
Posts: 269
Joined: Apr 4th, '11, 09:16


Return to Advanced support

Who is online

Users browsing this forum: No registered users and 1 guest