Thursday, August 9, 2007

I need some help!

Okay. So, if you are a UNIX genius, you might be able to help me with this.

I have an application that uses the system() command to send a command to the terminal. I'm using sudo to allow the user to delete files that belong to root.

so an example will be something like this
system("sudo rm /file/to/delete.txt");

But, as soon as this runs, it asks in terminal for a password.

Here's the thing. I need it so that all authentication is done without the terminal. It all needs to be handled in the objective-c application.

Is there a way to pre-authenticate the user so that sudo will work without asking for a password in terminal? Is there another way to delete files that belong to root in objective-c? If you can answer this, please help me out. That would be great!


jr said...

That would circumvent the whole purpose of sudo. You have to enter your password for sudo to elevate your privileges for the same reason you have to enter your password to modify settings in your System Preferences.

Cruiser said...

I think what the author is requesting for is a way to accept the password in a NSWindow or Sheet and not in a Terminal.