Mailinglist Archive: opensuse (946 mails)

< Previous Next >
Re: [opensuse] Run command as another user
On 2017-09-29 22:36, David T-G wrote:


The more detail you can give us, the better we can provide ideas :-)

He said he wants to do this in C:

system("command", username, password);

Plain simple :-)


I don't know of a way to call a command giving user and password in its
command line. Except expect. Or ssh with key pairs, not password.


He is not root, he can not configure sudo. He has sudo access and the
target user password. But sudo stops the script and asks for the
password. He wants the script to not ask, just provide the password
automatically.

Any method such as expect would store the password in a file in the
clear, so it is a security risk. Correct method I think would be ssh and
key pairs. The login session can store the password to the keys.

--
Cheers / Saludos,

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

< Previous Next >
List Navigation