Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Do you know any OS that is secure against an "attacker" with physical access without full disk encryption? – Mat May 28 '12 at 8:46
See "for instance, pressing F8 while certain versions of Microsoft Windows are booting, … editing the command line in GRUB". Also – RedGrittyBrick May 28 '12 at 8:59
up vote 7 down vote accepted

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/ in newer systems using SystemD).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .