Check out my first novel, midnight's simulacra!

Physical access: Difference between revisions

From dankwiki
(Created page with "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 <tt>/etc</tt> is not encrypte...")
 
No edit summary
 
Line 10: Line 10:
* If you intend to set a new root password using <tt>passwd</tt>, it's recommended to add an 'x' back to the <tt>/etc/passwd</tt>, so that <tt>/etc/shadow</tt> is used again:
* If you intend to set a new root password using <tt>passwd</tt>, it's recommended to add an 'x' back to the <tt>/etc/passwd</tt>, so that <tt>/etc/shadow</tt> is used again:
<tt>root:x:0:0:root:/root:/bin/bash</tt>
<tt>root:x:0:0:root:/root:/bin/bash</tt>
==Bypassing login==

Latest revision as of 09:58, 29 May 2020

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