For a server I'm building at the moment, my employer is particularly paranoid about security, and has insisted that all logins should be done via public/private keys, and that the actual passwords should be scrambled because they won't be needed. So I've written a little script that will automatically scramble a user's password ^^ Thought I'd share it here in case anyone else has a need for something like this.

uuencode can be obtained by emerging sharutils if you don't have it. Basically it generates a random piece of garbage from /dev/urandom, then filters it through uuencode (using Base64 encoding with the -m option, since without it you occasionally get a : in the password which mucks up the password file!), and sets the user's new password with the usermod command. Interestingly enough, usermod already assumes the password is encrypted, so the string you see isn't the password anyway!

Disclaimer: Don't use this on your root account unless you have another way of logging in to it such as a public/private key pair! You may potentially render your root account useless._________________The Game is Nothing,
The Playing of it Everything

Cause this was what the employer wanted, so unfortunately when they're the one paying you, you kinda have to do what they're asking for _________________The Game is Nothing,
The Playing of it Everything

Disclaimer: Don't use this on your root account unless you have another way of logging in to it such as a public/private key pair! You may potentially render your root account useless.

If you have lost your root password, you may boot with gentoo minimal install cd, mount your system, chroot into it (follow the official handbook to know how to do it), and the password for root won't be needed. Then you'll be able to change it to a new one._________________Mangez du poulet !