Mailinglist Archive: opensuse (783 mails)

< Previous Next >
Re: [opensuse] Run command as another user
On 2017-10-06 13:43, Aaron Digulla wrote:
Am 29.09.2017 um 16:56 schrieb Paul Groves:
But in this case I am looking for something like the following:

char username = "bob";
char password = "bobspassword";
system("command", username, password);

If that makes sense? But I do not think system can do such a thing.
Can it?

The Unix guys have been working hard for 40 years to make Unix safe.
You'll have to follow the rules.

The command in question is called "sudo". sudo isn't magic. It's using
an API to switch the current user of a process.

The API call is "setuid"

You must be root to call it, otherwise you'll get an error.

Which he said he is not.

The only other option is SSH because you can ask bob to install your

If you read other answers, you will see there is another method. I
thought the same as you.

Cheers / Saludos,

Carlos E. R.
(from 42.2 x86_64 "Malachite" at Telcontar)

< Previous Next >
List Navigation