Faq-O-Matic Faq-O-Matic : Administrators' Guide : Maintain :
Manually setting a username/password | |
When prompting a user to create a username/password, it tells the user that they can email the administrator if they don't want to get emailed with their info.
However, it is not really documented how to manually set up a user if you ARE the administrator (until now ;)). Basically, there is a username/password file in the "meta" directory called "idfile", using the pattern "username@domain.com <encrypted password>". A browse through Auth.pm indicates that FOM is using Perl's crypt function - which according to www.perldoc.com behaves the same as the standard unix crypt() function.
You can manually edit the text file idfile to add/edit users. However, you have to use crypt() to generate the password. Apparently crypt() no longer comes standard on some *nix versions - you can get the source and compile it yourself, or you can make use of Perl's crypt function, just like FOM does. I've liberally borrowed from the cryptPass subroutine in Auth.pm to create a stand-alone password generator Perl script, below:
| |
#!/usr/bin/perl # genfaqpass.pl # Mostly borrowed from FAQ-O-Matic's Auth.pm # Usage: perl genfaqpass.pl <plain text password> use FAQ::OMatic; # only necessary if you want to use the seedRand() function below $pass = $ARGV[0]; FAQ::OMatic::seedRand(); # probably not absolutely necesary, but since FOM is installed anyway, why not $salt = pack('cc', 65+rand(16), 65+rand(16)); $crypted = crypt($pass,$salt); printf($crypted); printf("\n"); | |
This script uses the new MD5 method. It takes the username as an argument so that it can output a line that can be appended to your existing idfile. #!/usr/bin/perl # genfaqpass.pl # Mostly borrowed from FAQ-O-Matic's Auth.pm # Usage: perl genfaqpass.pl <plain text password> use lib '..'; # for suid installations use lib '/web/phoneboy/docs/fom/lib/site_perl/5.6.0'; use Digest::MD5 qw(md5_hex); use FAQ::OMatic; # only necessary if you want to use the seedRand() function below $username = $ARGV[0]; $pass = $ARGV[1]; my $salt = FAQ::OMatic::Entropy::gatherRandomString(); $crypted = " md5(".$salt.",".md5_hex($salt.$pass).")"; printf($username); printf($crypted); printf("\n"); | |
[Append to This Answer] |
Previous: | Backing up Faq-O-Matic |
|