Shell script to change the root password in Linux



Interactive Shell Script

#!/bin/bash

echo "Changing root password"
passwd root
echo "Password changed successfully"



Non-Interactive Shell Script

#!/bin/bash

new_password="your_new_password"

echo "root:$new_password" | chpasswd

echo "Root password changed successfully."





If you like please follow and comment