Where do linux systems keep the users encrypted passwords and how can it be decoded? Or maybe there is a workaround for getting the initial user's password? Thanks
Asked
Active
Viewed 45 times
2
-
This doesn't sound like a programming question, you should probably go over to http://serverfault.com/ and post there for this kind of thing. Or http://unix.stackexchange.com/ – Eric B Mar 30 '17 at 19:31
-
3One sould never store an encrypted password anywhere, and Unix and Linux systems do not do that. What is stored is a _hash_ of passwords. A hash is _not_ an encrypted version of a string, it cannot simply be "decrypted" or "decoded". A brute force attack is possible in general, but typically you'd have to use rainbow tables if a reasonable hasing algorithm is used, something you do not want to wait for to come to a successful result. Modern Linux systems use a "shadow file" for that, typically `/etc/shadow`, traditional unixoid systems store the hash in the standard `/etc/passwd` file. – arkascha Mar 30 '17 at 19:31
1 Answers
0
the default directory to the file that keeps passwords in Unix systems is
etc/passwds
and in macOS
etc/master.passwds
https://docs.python.org/3/library/crypt.html
you can read about crypt library of python which may help you to decode the Unix password. One of the ways I do it is I generate all possible Strings of a certain length 8, and then compare the hash from that file with the hash of each of these words. I am not sure that it is the optimal way of solving this question but it works.
Take a look here: Python generate all possible strings of length n