How I can generate random passwords for root

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

Hello.

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:

#!/bin/bash
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!

Desconectado
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

nadebula.1984
Desconectado
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.