What API do I call to set a user's password on linux? -


I know passwd (1) and crypt (3) . What I see is a API that will be set to pass the user's passwords in PassWood / Shadow file via password, without running in the program and writing entry for the user in question. The application runs in the form of root.

Is such an API present?

EDIT: It seems that I should specify that the password is being synchronized between different systems, so we can not call the system ("passwd") and the user will enter the password. Allow passwd to prompt them, we need to know the password so that we can programmatically update other systems with the same password.

As 8jean commented above, it seems that / usr / sbin / chpasswd can be the easiest way Otherwise I have gone with the comments of Noah to use functions such as fgetpwent () - or fgetspent () to deal with the shadow file - to run on the list of users and to change the record (s) which I need to change Thanks, everybody!


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -