How I can generate random passwords for root

2 respostas [Última entrada]
Joined: 09/26/2021


Somebody can help me ? I need generate random passwords for "root"
everytime I login. Or "cron job". Please tell me, how I can start this
process ? Below is example, but when I used command "passwd root $pass",
this not work. I can manually, but automatic not work. This script
I was execute as root of course.

For example:

pass=$(dd if=/dev/urandom bs=1 count=16 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev )
passwd root $pass
echo $pass

[ Sorry for my english, I don't speak in this language ]

Magic Banana

I am a member!

Joined: 07/24/2010

I need generate random passwords for "root" everytime I login.

Here is a weird need. Can you explain why please? If the generated password is written on the disk, readable by you, then an attacker would only need to exploit a vulnerability giving her your permissions (exploiting a vulnerability in any program you run, including a graphical one) to be able to read the root password.

Trisquel has no root password by default: root cannot log in.

Or "cron job".

I believe that would indeed be the way to go, calling the script from root's crontab. You can edit it with:
$ sudo crontab -e

Joined: 05/01/2018

I'm not sure whether I could make root account unlocked (i.e., setting a password for it) by using text-mode installer (something like Debian Installer). But you can try it.