Link to home
Start Free TrialLog in
Avatar of pucko
pucko

asked on

PHP or Perl script to change user's password?

Can someone point me to a perl  or php script that allows the user to change password for a linux machine on a webpage ?
Avatar of Adam314
Adam314

Are the passwords stored in /etc/passwd, or are you talking about a different password?
Is the machine that is running the webserver the same machine for which you want to change the password?
Avatar of pucko

ASKER

Yes the system password. (that you change using the passwd command if you are logged in)
But it's  stored in /etc/shadow  not passwd
Avatar of pucko

ASKER

and yes it's the same machine
Avatar of pucko

ASKER

If it helps it's a apache webserver.  I realy don't care if it's php, perl or whatever.
I need the users to be able to change their passwords through a webpage.
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pucko

ASKER

Can you help me create the Form?

Also how and where do I add this sudo entry?
Avatar of pucko

ASKER

And one thing. Does the user need to enter their old password to do this? (I realy need it to work that way)
The form would look like:

<form action="/cgi-bin/passwd.cgi" method="POST">
Username: <input type="text" name="user" size='8"><br>
Password: <input type="password" name="password" size=20"><br>
<input type="submit">
</form>

You add the sudo entry by using the 'visudo' command.

If you want to have the user specify their old password, then it becomes a lot more complex as you need to use an expect script and trap all the various responses.