Scripted setting of users passwords; RHEL/CentOS and now Ubuntu/Debian/others too

I’ve been setting users passwords successfully on CentOS/RHEL from within my kickstarts, using entries like this:

echo p4ssw0rd | passwd --stdin username

… however, that unfortunately doesn’t work on at least Ubuntu (and possibly many other distros as well).

Now – finally – and thanks to this comment, I have an answer; and it looks something like this:

echo username:password | chpasswd