Technology computers-hardware

How to Change the Root Password Using Perl

    • 1). Log in as root or a user with root privileges.

    • 2). Call the system command from within your Perl script. The syntax is:

      system("command");

      Note the quotation marks; they are necessary.

    • 3). Use the "passwd" command to change the password of a specific user; in this case root. Your command should look something like this:

      system("echo "your-new-password" | passwd --stdin root");

      where your-new-password is the password you'd like to use for root. Retain all the quotation marks.

    • 4). Run your Perl script; root's password should now be changed.



Leave a reply