Change Password PHP Script

updated on
Masayuki Nii / | facebook: Masayuki Nii | Twitter: masayukinii

What is this?

This is the PHP script to change the password of the specified user account. You should supply your user name and current password with new password.

I've checked it with OS X Lion and PHP 5.3.6. This script uses the "passwd" command to change the password. So it could work on other UNIX-based operating system, but I don't check other environments. On Mac OS X, you can change the password both local and network users.


Extract this file and put within the web server document folder. It's just one script file. Of course, it must support PHP script with Web server. After that, you could access to this file, as like "http://yourdomain/youpath/changepassword.php".



We Mac server administrators used "osxpass.cgi" to change the password. But it is a PowerPC binary and can't work on Lion. I tried to recompile it but so many api were deprecated anymore. So I made the script to change the password with UNIX way. This script could be alternative to "opxpass.cgi."

I know OS X Server has the wiki features and it includes to change the password. But it can't use on OS X Lion. Additionally, the Workgroup Manager has the account option to prevent to login without changing password. If they set it, no one can login to wiki and change their password.

You can use this script freely, but if you know any issues, please let me know.