Q. Can you tell me more about unshadow and john command line tools? How does it protect my server from crackers?
A. Both unshadow and john distributed with - John the Ripper security software or fast password cracker software. It is free and Open Source software. It runs on Windows, UNIX and Linux operating system. Use this tool to find out weak users passwords on your own server.

John cracking modes
John can work in the following modes:
[a] Wordlist : John will simply use a file with a list of words that will be checked against the passwords. See RULES for the format of wordlist files.
[b] Single crack : In this mode, john will try to crack the password using the login/GECOS information as passwords.
[c] Incremental : This is the most powerful mode. John will try any character combination to resolve the password. Details about these modes can be found in the MODES file in john’s documentation, including how to define your own cracking methods.
Install John the Ripper Password Cracking Tool
John the ripper is not installed by default. If you are using Debian / Ubuntu Linux, enter:
$ sudo apt-get install john
Note: RHEL, CentOS, Fedora, Redhat Linux user can grab john the ripper here. Once downloaded use rpm command:
# rpm -ivh john*
How do I use John the ripper to check weak passwords / crack passwords?
First use the unshadow command to combines the /etc/passwd and /etc/shadow files so John can use them. You might need this since if you only used your shadow file, the GECOS information wouldn’t be used by the "single crack" mode, and also you wouldn’t be able to use the -shells option. On a normal system you’ll need to run unshadow as root to be able to read the shadow file. So login as root or use old good sudo / su command under Debian / Ubuntu Linux:
$ sudo /usr/sbin/unshadow /etc/passwd /etc/shadow > /tmp/crack.password.db
RHEL / CentOS / Fedora Linux user type the following command:
# /usr/bin/unshadow /etc/passwd /etc/shadow > /tmp/crack.password.db
To check weak password (crack password), enter the following command:
WARNING! These examples uses brute-force ~ CPU-time consuming password cracking techniques.To use John, you just need to supply it a password file created using unshadow command along with desired options. If no mode is specified, john will try "single" first, then "wordlist" and finally "incremental" password cracking methods.
$ john /tmp/crack.password.db
Output:
john /tmp/crack.password.db Loaded 1 password (FreeBSD MD5 [32/32])
This procedure will take its own time. To see the cracked passwords, enter:
$ john -show /tmp/crack.password.db
test:123456:1002:1002:test,,,:/home/test:/bin/bash didi:abc123:1003:1003::/home/didi:/usr/bin/rssh 2 passwords cracked, 1 left
Above output clearly indicates - user test has 123456 and didi has abc123 password.
Related:
- Linux check passwords against a dictionary attack
- John the ripper examples text file for more information.
Further readings:
- John the ripper project home page
- Refer john and unshadow command man page
- John the ripper examples text file
- John configuration file /etc/john/john.conf
Rainbow table - Rainbow Cracking uses differs from brute force crackers in that it uses large pre-computed tables called rainbow tables to reduce the length of time needed to crack a password drastically. See Ophcrack Live CD.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop














{ 31 comments… read them below or add one }
It clearly shows that the more complex and non-dictionary words we use, the longer it takes for John to crack them.
Rules of thumb,
- never use the same password forever, change it on a periodic time.
- don’t use personal information as password or any partial of that
- mix numbers, punctuations. symbols if possible
- never share password to others
- never use root account for normal usage
- keep system up to date always
One more addition, give shell access only if required.
And one more- Disable unwanted features for users.
Like- SSH.
its better to make /tmp/crack.password.db to /root/crack.password.db. isn’t it?
nice short tutorial: just a question though:
whats the equivalent of this command in non redhat variant systems where unshadow does not exist?
sudo /usr/sbin/unshadow /etc/passwd /etc/shadow > /tmp/crack.password.db
unshadow is part of the package. It should be at /usr/sbin or /usr/local/sbin
Always take care that you dont alter the file permissions for the /etc/shadow file, which by default is “-r——–” read only for root(This is definetly true for CentOS and FC,am not sure about the rest). If the read permissions are set for the user for /etc/shadow, a non root user may be able to execute john to retrieve passwords for root as well as other users on that system. Overall this system can then be viable to remote attacks via pre installed back door user accounts.
Well i can say its simply doesnt work on tough passwords it works only on simple text passwords i dont know y this package got so…much of popularity
a simple steap is linux passwd
I have recentaly accured some passwods and am in need of a nother there are 3 computers that anr pertected by passwords I have 2 of them but the last one evades me for computer 2 the password is 036915307. for computer3 the password is036915364.
i need the passwoed for computer1 the pass words goes 0369152 I could not figure out the res if some one would help i would appreat it.
smith
sounds like phone numbers in the tel-aviv (israel) area codes :)
Hi, this is working to crack the week passwords only, I can’t crack my root password; how to crack touch passwords. If anybody know the solution, please mail me.
kalidosstvr@yahoo.in
really helpfull. thanks
I don’t think JTR is compatible with the new SHA512 encryption on most Linux distributions…
N0x ye be right:
~$ john /tmp/crack.password.db
No password hashes loaded
me too!!
That simply means that there is no password hashes in the file, which you try to search into
Try with those:
num:CR9.E1Q9XBCbs:0:1:Operator:/:/bin/csh
dra:CR.L.LLfgc/5Y:0:1:Operator:/:/bin/csh
sec:CR6Xdsh28cJFA:0:1:Operator:/:/bin/csh
I think John the Ripper community-enhanced version supports SHA but the regular release does not, perhaps the John Pro supports SHA too…
nice for dumies.. I’ll try :)
Nice Application;
Hello
dear….
how to break password of root in Rhel 6.0
Thanks
I hav a problm when making a copy:
cp /etc/passwd > passwd.1—>cp: opérande du fichier cible manquant après `/etc/passwd’
Pour en savoir davantage, faites: « cp –help ».
Can someone help me!thank
hey jabronis, this will work on strong passwords. it has a brute force mode which checks all possible combinations, you just have to be patient :p
EPIC FAIL in ubuntu 11.04
Did you try installing from source? I had the same issue with the ubuntu binaries.
hello sir,
I forgot my ubuntu password so please help me. here no service center.
Just saved me a lot of time!
‘Hats off to John the Ripper’!!!
I had the same problem (Debian squeeze), too. So I uninstalled “john” and “john-data” via apt-get and compiled it by myself. Now it is running wonderful!
@VIVEK: Thank you for this short but detailed article.
Can you please help, I can not decrypt.
root:KPcKrCeGUgGeA:1201282644:0:0
Thanks
Hi in linux there is security password are locked .i dont know the password what should i do
Hi ,
I am getting the following error on My RHEL6.3 machine. Can anyone help me?
john /root/crack.password.db
fopen: $JOHN/dynamic.conf: No such file or directory