I had a peek about and could not find a web interface for smbpasswd. I have been helping a friend run a school network and after a year they would still rather use something that a text interface.
I had a look at webmin; however although I could add unix users I could not change samba passwords and the swat interface was not helpful. (In addition I did not want people playing with shares or other configuration options in SWAT). There is also smbpasswd.php as an rpm package, which had a load of pear dependencies, which were not a standard part of a distribution and I did not want random items to break on upgrade.
I have three files that require amendments to the sudoers file and server side includes enabled. I should also mention that this has been thrown together and is on a local network and is only accessed using ssl and is behind a password protected page. It is not secure and will allow people to do nasty things to your smbpasswd file.
The files are here: smbpasswd.php; write_data.php; final.shtml.
The changes to sudoers is as follows (using visudo):
apache ALL= NOPASSWD: /usr/bin/smbpasswd -s -a
The changes to the httpd.conf file to enable includes is:
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
<html> <head> <title> Changing Windows' User's password </title> </head> <body> <strong>Changing a Samba Password</strong> <form method="post" action="smbpasswd.php"> <br>Username is <input type="text" Name="username"><br> <br>Password is <input type="password" Name="pass1"> <br>Password is <input type="password" Name="pass2"> (confirmation)<br> <br><input type="submit" value="Step two"> </form> </body> </html> ___ write_data.php
<html> <head> <title> Change Password - Step two </title> </head> <body> <?php //create a file with data $file = @fopen("/full/path/htdocs/pass.dat","w"); $file2 = @fopen("/full/path/htdocs/user.dat","w"); fputs($file,$pass1."\n".$pass2 . "\n"); fputs($file2,$username."\n"); ?> <form method="post" action="changepass.html"> <br>You are about to add a new samba user or change the password on an existing user. <br><strongAre you sure?</strong> <br>Username is <?php echo "$username" ?> //<br>Password is <?php echo "$pass" ?> <br><input type="submit" value="Yes, I am Sure"> </body> </html> ___ final.shtml
<html> <head> <title> Changing Passwords Final Step </title> </head> <body> <br> <!--#exec cmd="sudo smbpasswd -s -a `cat /full/path/htdocs/user.dat` < /full/path/htdocs/pass.dat" --> <!--#exec cmd=" > /full/path/htdocs/user.dat; > /full/path/htdocs/pass.dat" --> <br> </body> </html>