Hi all:
Got a task to have end users change their samba passwd from a web page. I would like to use perl but having hacked and tried for the last few days, I am not getting anywhere. I have gotten farther using bash.
The end users are CLI illerteriate, if it isn't on windoze or a web page they are lost. The need for this is coming as a result of WIN7 putting in another level of authentication for samba and it will not allow for blank passwds. (It will, but research I have done says it is a registry change.)
The system that has the smbpasswd is a RH5 system with apache.
I have searched for something similar but to no avail, all I can find are programs that change the LDAP, NIS, AD, & samba passwds - but all I want (need) is to change the samba passwd. Nothing else. Nothing complex, just plug the user entered values into the smbpasswd command, being called by sudo. But I cannot seem to get the user entered values to populate the sam_chg script.
Here is what I have;
#!/bin/bash
echo "Content-type: text/html"
echo ""
echo "<html><head><title>Change CIFS password</title></head><body>"
echo ""
printf '<h1>CIFS passwd change</h1>'
echo ""
echo "Today is $(date '+%Y-%B-%d %H:%M:%S')"
echo ""
printf '<h3>Enter your username: <input type="text" name="username" size="20" /></h3>'
printf '<h3>Enter your old password: <input type="text" name="old_pass" size="20" /></h3>'
printf '<h3>Enter your new password: <input type="text" name="new_pass1" size="20" /></h3>'
printf '<h3>Re-Enter your new password: <input type="text" name="new_pass2" size="20" /></h3>'
echo ""
echo "<input type="Submit" name="submit" value="submit form" />"
echo "<form action="sam_chg.bsh" method="POST">"
echo ""
echo "</form>"
echo "</body></html>"
The sam_chg.bsh contains the following;
#!/bin/bash
printf "$2\n$3\n$4\n" | /usr/bin/sudo /usr/bin/smbpasswd $1
Any help, please?
Thanks!
Got a task to have end users change their samba passwd from a web page. I would like to use perl but having hacked and tried for the last few days, I am not getting anywhere. I have gotten farther using bash.
The end users are CLI illerteriate, if it isn't on windoze or a web page they are lost. The need for this is coming as a result of WIN7 putting in another level of authentication for samba and it will not allow for blank passwds. (It will, but research I have done says it is a registry change.)
The system that has the smbpasswd is a RH5 system with apache.
I have searched for something similar but to no avail, all I can find are programs that change the LDAP, NIS, AD, & samba passwds - but all I want (need) is to change the samba passwd. Nothing else. Nothing complex, just plug the user entered values into the smbpasswd command, being called by sudo. But I cannot seem to get the user entered values to populate the sam_chg script.
Here is what I have;
#!/bin/bash
echo "Content-type: text/html"
echo ""
echo "<html><head><title>Change CIFS password</title></head><body>"
echo ""
printf '<h1>CIFS passwd change</h1>'
echo ""
echo "Today is $(date '+%Y-%B-%d %H:%M:%S')"
echo ""
printf '<h3>Enter your username: <input type="text" name="username" size="20" /></h3>'
printf '<h3>Enter your old password: <input type="text" name="old_pass" size="20" /></h3>'
printf '<h3>Enter your new password: <input type="text" name="new_pass1" size="20" /></h3>'
printf '<h3>Re-Enter your new password: <input type="text" name="new_pass2" size="20" /></h3>'
echo ""
echo "<input type="Submit" name="submit" value="submit form" />"
echo "<form action="sam_chg.bsh" method="POST">"
echo ""
echo "</form>"
echo "</body></html>"
The sam_chg.bsh contains the following;
#!/bin/bash
printf "$2\n$3\n$4\n" | /usr/bin/sudo /usr/bin/smbpasswd $1
Any help, please?
Thanks!