Physical access

From dankwiki

So you've got physical access to a UNIX box. How do you get root access?

Removing root password

This requires that the filesystem containing /etc is not encrypted. Remove the disk with the filesystem containing /etc, and mount it on another machine.

  • Edit /etc/passwd, and remove the second field for the root entry:

root::0:0:root:/root:/bin/bash

  • Edit /etc/shadow, and do the same:

root::18242:0:99999:7:::

  • If you intend to set a new root password using passwd, it's recommended to add an 'x' back to the /etc/passwd, so that /etc/shadow is used again:

root:x:0:0:root:/root:/bin/bash

Bypassing login