Following scenario:
- I do have sudo permissions
- I know the old and new password of a user
Now I want to write a C# .NET 6 application which can change the password of the user. In Linux I would just call
sudo passwd username
My first idea was to create a new process, redirect the stdin and write the password there.
Another option would be to create a bash script and call it from C# (also using a new process).
However, both seem a little bit hacky to me. Is there any option to change the password in-process in C#?