Adduser utility to generate "random" passwds ?
Michael
bsdquestions at gmail.com
Tue Jan 9 16:29:33 UTC 2007
Frank Bonnet wrote:
> Hello
>
> Is there a possibility to use as a standalone software
> the adduser feature that generate "random" passwd.
>
> I want to generate new "strong" password for existing users.
>
> Thank you
>
> Frank
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe at freebsd.org"
>
Another good choice for separate password generation is apg which is
also in the ports. What I like about apg is that it also provides a
basic phonic for each password you can generate that helps you to
remember your password. As you may already know, having completely
ambiguous random passwords isn't necessarily the best thing to use since
most users will tend to write them down on paper somewhere and defeat
the real purpose for generating good secure passwords in the first place.
Here is a small script that can generate these passwords via a web
interface which is quite nice. It does require that you have a ksh
shell however since it was written with this shell in mind.
#!/usr/local/bin/ksh93
PATH=/bin:/user/bin:/usr/local/bin:/; export PATH
umask 077
a=/tmp/apg.$RANDOM
b=/tmp/apg.$RAMDOM
cat << EOF
Content-type: text/html
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>Help generating a new password</title>
</head>
<body>
<h3>Help generating a new password</h3>
<blockquote>
These passwords should be reasonably safe.
Feel free to use one, or reload the page
for a new batch.</p>
</blockquote> <pre> <font size="+1">
EOF
apg -q -m 4 -x 4 -M NC -E '!@#$%^&*()\\' -n 10 > $a
apg -q -m 4 -x 4 -M S -E '!@#$%^&*()\\' -n 10 > $b
# tr command is for bug workaround; apg is not supposed to
# include characters specified after -E option
paste $a $b |
tr 'l' 'L' |
awk '
BEGIN {
printf "Password\tRough guess at pronunciation\n<hr />"
}
{
printf "%s%s\t%s %s\n", $1, $3, $2, $4
}'
cat << EOF
</font>
</pre>
</blockquote>
</blockquote>
<hr />
</body>
</html>
EOF
rm $a $b
exit 0
This script is from the book BSD Hacks, enjoy!
Michael Lawver
More information about the freebsd-questions
mailing list