In CentOS 6.0, we can change the root password even if we don't know it (or if we forgot that password).

This is the method:

  1. At the boot loader menu, press "e" to edit the kernel
  2. Select the second line (it begins with the word kernel)
  3. Edit the line by pressing "e"
  4. At the end of this line, add the word "single", without quotes
  5. Exit out of this line by pressing enter
  6. Boot the kernel while having that line highlighted by pressing "b"
    It will boot into single user mode
  7. Type "passwd", without quotes, and it will prompt you for a new password
  8. Enter your new root password and login.

Suppose if any normal user changes the root password with this method, then other users will be affected (if server is hacked).

Then how is Linux secure?


1 Answer 1


The assumption is that if you have physical access to the machine, then the machine can be compromised.

That being said, you can either password-protect the Grub boot loader, or password-protect the single-user mode. You'd also need to password-protect the BIOS to prevent people from booting from USB and then accessing the partitions directly, and also, to go further, disable Control-Alt-Delete in /etc/inittab (or /etc/systemd/system/ctrl-alt-del.target in newer systems using SystemD).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.