Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-27-2006, 02:49 AM   #1
Registered: Oct 2004
Location: India
Distribution: FC 12
Posts: 233

Rep: Reputation: 30
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
Old 05-27-2006, 03:06 AM   #2
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
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.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script to change password kamal_aitin Linux - General 6 07-25-2007 01:09 AM
Help! Cannot Add a User to User Manager or Change Root Password lennysokol Linux - General 2 06-25-2005 10:59 AM
what is the command to make a user change their password after creating a new user? naweenio Linux - Newbie 7 01-05-2005 08:07 AM
how to assign password for a user in shell script mtest Programming 10 10-29-2003 07:52 AM
Restricted shell to change the password mussons Linux - Security 12 07-24-2003 11:05 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:06 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration