On Mon, Oct 2, 2017 at 4:02 PM, Paul Groves
On 30/09/17 00:33, Carlos E. R. wrote:
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.
SSH is rather unnecessary as it only needs access to the local machine.
This is still the simplest way to log in as another user (and without password); and it can be configured to execute only specific command for a given public key.
Is there a way of logging into a local shell as a user in C to run the commands?
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.
Exactly!
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.
Unless I could save the password as something like an md5 string? Then decrypt that in the C program.
You cannot "decrypt" md5. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org