To change the root password, use the passwd command as follows:
root@kali:~# passwd Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
To generate new SSH host keys, the steps are also relatively straightforward: remove the current SSH host keys, use the dpkg-reconfigure openssh-server command to reconfigure the OpenSSH server, and generate new SSH host keys:
root@kali:~# rm /etc/ssh/ssh_host_*root@kali:~# dpkg-reconfigure openssh-serverCreating SSH2 RSA key; this may take some time ...2048 SHA256:Ok/J4YvIGYieDI6YuOLDXADm5YUdrJSnzBKguuD9WWQ root@kali (RSA)Creating SSH2 ECDSA key; this may take some time ...256 SHA256:eYU5TtQVzFYQtjo6lyiVHku6SQWbgkMPMDtW8cgaAJ4 root@kali (ECDSA)Creating ...