How to decode the hash password in /etc/shadow

I don't know much of Ubuntu, but is Ubuntu able to decode these sort of things? Or do I need to install some program? If I don't, how do I use Ubuntu to read the file?


Solution 1:

In short - you can't!

/etc/shadow stores a hashed version of the password. This is, for all intents and purposes, impossible to recover because hashing is a one way operation.

This stops malicious people being able to read the passwords of users on the system.

Solution 2:

You need to install john the reaper.

$ apt install john

Then only 2 commands

$ unshadow /etc/passwd /etc/shadow > mypasswd.txt 
$ john mypasswd.txt

When it is finishes (in 1-5 min for password with 4 numbers), you'll see password you need.

$ john --show mypasswd.txt

Solution 3:

Let's make it simple : No. Passwords are not meant to be decrypted, what would be the point ? No technique, no utility will allow you to do such a thing. Behind those passwords are huge algorithms meant to be one-way only.

However, you can read the file (and see encrypted passwords) by doing :

sudo cat /etc/shadow

You'll need to be a sudoer, or root himself (in which case, sudo is useless)