Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a linux pc on which several users are configured to login. for the same PC i have the root access (username and password). I have lost one of the user accounts password. How to get back the password for that particular user account. I have tried the following being a root user

passwd <login name>
Enter new password
confirm new password

But its not fruitful could you please suggest some ways of recoverng the password.

Also,I got to know that passwords are stored in /etc/shadow file in encrypted form. Does anyone know how to get the decrypted form of encrypted password.

share|improve this question

migrated from stackoverflow.com Jun 20 '12 at 6:11

This question came from our site for professional and enthusiast programmers.

    
This question doesn't really seem to be about programming; I think it would be more appropriate for another site in the Stack Overflow network - perhaps ServerFault? –  Philip Kendall Jun 20 '12 at 5:38
    
Why do you need to know the passwords of others? –  kev Jun 20 '12 at 5:39
    
It is not encrypted, it is hashed. That's a difference, encryption implies that it can be decrypted, which is not the case, as a hash is a one-way function with no means to reverse the process. –  Bobby Jun 20 '12 at 12:03
add comment

3 Answers

The whole point of storing hashed passwords in /etc/shadow is so that it is not possible to retrieve the plaintext password, so there is no way to determine what the current password is. Your only option is to reset the password using passwd <username> as root.

share|improve this answer
add comment

If you wish to try to brute force it, the hashes are stored in /etc/shadow. They are salted, so a rainbow table attack will likely not work. You can try John the Ripper to brute force it, but unless the word is a dictionary word or otherwise very weak, I do not think you will have much luck.

share|improve this answer
add comment

You must enter the command

passwd $user

where $user is replaced with the account username that has lost the password.

If you're just entering passwd naked, with no arguments, then passwd assumes that you're wanting to change the password of the currently logged in user.

Also, make sure you're using su root to start a root shell, running sudo, or such.

share|improve this answer
    
this will allow you to change the account password, not recover it, but after that the user can change it by entering passwd in a terminal window. –  shinyspoongod Jun 20 '12 at 5:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.