Change user password via bash script

Associate
Joined
2 Sep 2007
Posts
2,001
Hi All

I'm trying to change a user's password via a bash script I found this solution on another forum but it doesn't work does anyone have any other solutions?

The error I get with the following is unrecognized option '--stdin'

passwd can use the --stdin flag
passwd --stdin <user> <password>
note: only root can do this, but for any user
 
Hi

Basically I'm writing a script to create a user, set their password, jail the user, setup a mysql db, etc. I didn't want to have to type in their password as I'm going to code a simple PHP script to do it all. Anyway I managed to find a solution.

echo username : password | chpasswd
 
Back
Top Bottom