On Tue, Aug 30, 2011 at 07:16:00PM +0100, Michael wrote: > Hello, > > When adding a new user it is possible to assign a random generated > password. But is it possible to assign a random password for already > existing users? > > Preferably in a non-interactive and scriptable way. Is it possible with > the base system tools?
Generating a random password can be done with the openssl in the base system; openssl rand -base64 9 You'd want to pipe the output of this command through tee(1) and save it in a file. Next you pipe it to a file discriptor leading to a 'pw usermod -h 0'. Something like this: openssl rand -base64 9 | tee -a newpasswords | pw usermod UID -h 0 where UID is the user-id or name of the user in question. Roland -- R.F.Smith http://www.xs4all.nl/~rsmith/ [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
pgp91FVL1FP8P.pgp
Description: PGP signature