Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

This question already has an answer here:

Is there a specific location where the passwords are stored ?

Is it depending on which version is used ?

Are they salted ?

share|improve this question

marked as duplicate by Adnan, Terry Chia, dr jimbob, Gilles, Rory Alsop Jun 6 '13 at 18:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 4 down vote accepted

Linux passwords are stored in the /etc/shadow file. They are salted and the algorithm being used depends on the particular distribution and is configurable.

From what I recall, the algorithms supported are MD5, Blowfish, SHA256 and SHA512. Most recent distributions should be on SHA512 by default if my memory serves me right.

share|improve this answer
    
It's important to note that while the crypt documentation refers to MD5, SHA256, SHA512 that they are not one application of the simple cryptographic hash function, but it uses en.wikipedia.org/wiki/Crypt_(C) which generally provide 1000 (MD5) to default of 5000 rounds of the cryptographic hash function. –  dr jimbob Jun 6 '13 at 16:16
    
@drjimbob Ah yes, should have mentioned that. :) –  Terry Chia Jun 6 '13 at 16:17

Passwords in unix were originally stored in /etc/passwd (which is world-readable), but then moved to /etc/shadow (and backed up in /etc/shadow-) which can only be read by root (or members of the shadow group).

The password are salted and hashed. The default formats are MD5-crypt, bcrypt, sha256-crypt, sha512-crypt, and for historical reasons DES (note DES only allows 8-byte passwords). Note, sha512-crypt is typically involves 5000 rounds of SHA512-ing the password and the number of rounds is configurable.

For more info consult man crypt, man shadow, man passwd.

share|improve this answer
    
how are the passwords salted? Since the Linux kernel is open source, is not the salt algorithm known by the world and therefor useless? –  Rox Jun 7 '13 at 16:25
    
@Rox - First, salts work by being at high-probability a unique string that's concatenated to the password before its hashed. Therefore, someone can't attack millions of passwords in parallel; (e.g., generate sha256crypt's of a list of 100 million common passwords once and then compare against all million hashes you have until you find matches). Instead to attack just one hash with a unique salt, you'd have to try all the common passwords (concatenated with that unique salt) until one worked. Note the salt is stored with the hash, as to check a password you need to use the salt. –  dr jimbob Jun 7 '13 at 17:46
1  
@Rox - Furthermore, the linux kernel being open-source is not relevant either. IIRC, the random salt is created from /dev/random, which uses true random bits are accumulated from measuring the noise properties of your system (e.g., did it take an even or odd number of clock cycles to access something from disk or time between keystrokes/mouse movements); so it is not predictable, even if it is open source. –  dr jimbob Jun 7 '13 at 17:49
    
Thanks for a good explanation! –  Rox Jun 10 '13 at 19:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.