-   Linux - Software (
-   -   Can my shell script change the password of user ? (

prabhatsoni 05-27-2006 01:49 AM

Can my shell script change the password of user ?
Hello Gurus,

I am struck up.

I have a portal where I am saving user passwords and names, privileges in an mysql table. The interface is web based, with apache+php+mysql.

Some of the service like access to various databases are available to users through web interface. Password-change facility has been given to the users wherein the password in the mysql table is changes through a mysql query (through php). Fairly easy to impelement.

But there are some services which use system accounts. Thus each user has two accounts. One in the mysql database and the other in the system. Highly undesirable and irregular.

I was thinking of running a shell script (from php) which will set the system password to the new password given by the user. Thus whenever the user changes his password, it will be changed in both the places - giving him a feeling that there is only one account.

The shell script which would change the user password in the system account seems to be a tough nut to crack. I have searched this very forum without success.

Can any of the gurus help me.

-Thanks in advance.

Prabhat Soni

macemoneta 05-27-2006 02:06 AM

The chpasswd command will do what you want.

man chpasswd

chpasswd reads a list of user name and password pairs from standard input and uses this information to update a group of existing users.

All times are GMT -5. The time now is 09:20 PM.