PDA

View Full Version : Another Script question



blooddrunk
July 13th, 2008, 07:24 PM
In my C program I need to add the 'useradd' function. But ,as you all know, adding a user in Linux requires root privileges. Is there a way through a script or system()function to make that command run on every computer without prompting for root's password. 10x in advance

unutbu
July 13th, 2008, 07:30 PM
Run your program as root.

imdano
July 13th, 2008, 07:33 PM
Yeah, it'd sort of defeat the purpose of making adding a user require root privileges if you could get around it with a script or function call.

LaRoza
July 13th, 2008, 07:34 PM
Is there a way through a script or system()function to make that command run on every computer without prompting for root's password.

What? Did I read that correctly?

pmasiar
July 13th, 2008, 09:13 PM
Is there a way through a script or system()function to make that command run on every computer without prompting for root's password.

No, and if you think for about 5 secs, you will realize why :-)

LaRoza
July 13th, 2008, 10:30 PM
No, and if you think for about 5 secs, you will realize why :-)

Technically, before they fixed that sudo bug (which could be used to bypass the prompt on a local machine) you could, but that was a bad bug and not a feature. It doesn't exist anymore.

blooddrunk
July 14th, 2008, 08:15 AM
Technically, before they fixed that sudo bug (which could be used to bypass the prompt on a local machine) you could, but that was a bad bug and not a feature. It doesn't exist anymore.

I thought so. Thanks to all of you, anyway

rnodal
July 15th, 2008, 05:21 AM
Or you can exploit some system function that would allow you to execute your own code but you don't want to do that because it is not nice. :)