LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   can a password be decrypted (https://www.linuxquestions.org/questions/linux-newbie-8/can-a-password-be-decrypted-748109/)

usmansamad 08-17-2009 08:09 AM

can a password be decrypted
 
Hello,

I have a question. in /etc/shadow the passwords of different users are stored in encrypted form. Is there a way we can decrypt them?

Regards,
Usman Samad

Wim Sturkenboom 08-17-2009 08:31 AM

There is no decryption algorithm; these are hashes (one way 'encryption').

pwc101 08-17-2009 08:40 AM

You can brute force them, of course, but finding programs that do that is an exercise I leave to the OP.

pixellany 08-17-2009 08:42 AM

Quote:

Originally Posted by usmansamad (Post 3646412)
Hello,

I have a question. in /etc/shadow the passwords of different users are stored in encrypted form. Is there a way we can decrypt them?

Regards,
Usman Samad

Why?

They are encrypted so that--e.g.--you cannot look over the administrator's shoulder and get another user's password. If you have admin privileges, you can change anyone's password.

What is it that you are trying to do?

w1k0 08-17-2009 08:57 AM

Look at John the Ripper the password cracker: http://www.openwall.com/john/. Some day I decided to try it. I used it on my system with three users. After a few hours of continuous work of the program I stopped it. I stated my passwords are strong enough.

i92guboj 08-17-2009 09:54 AM

You can't actually de-crypt them in the correct sense of the word.

John can actually find passwords that are valid matches for a given hash, which in practical terms might be the same 99% of the time, but it's not quite the same at all, and it can really take like years unless your passwords are of a very low quality.

The whole idea of storing only the hashes is, as said above, that you can't reverse them. You can only check if a given password is valid for a given hash. That's called "brute forcing", and the only shorthand is the use of a dictionary, which only works if your passwords are bad ones. A good password will never resemble anything that appears on a dictionary.

pixellany makes the real point: why? if you are not root, then you are trying to do something bad, and you will not get help here. If you are root, just change the passwords to whatever you want. You don't need the original ones. Otherwise, explain yourself.

usmansamad 08-17-2009 10:06 AM

Actually i wanted to SSH few files at a server where root access was not allowed so i had to login with the user then sudo bash to access root. So it was getting a little difcult while SSH files as i didnt know root password. Thats why i asked.
Any way thnx to all of u.

i92guboj 08-17-2009 10:16 AM

If you don't know the root password then it's because you are not supposed to log in as root, it doesn't matter if it's ssh or local login. Really, passwords are there for a reason, if everyone could read them from /etc/passwd there would be no point at all in having them. That's why they was moved to /etc/shadow long ago, and that's why that file is not world-readable, and why passwords are hashed so they can't be de-cyphered.

If you are doing a legitimate administrative task that truly require root privileges then I am sure that you will have no problem contacting the root user and asking him for permission, or for a solution that can work for both of you.

Wim Sturkenboom 08-17-2009 10:52 AM

Quote:

Originally Posted by usmansamad (Post 3646646)
Actually i wanted to SSH few files at a server where root access was not allowed so ...

That is to prevent brute force attacks on the root account. Every server should be setup like that.

pixellany 08-17-2009 11:20 AM

Quote:

Originally Posted by usmansamad (Post 3646646)
Actually i wanted to SSH few files at a server where root access was not allowed so i had to login with the user then sudo bash to access root. So it was getting a little difcult while SSH files as i didnt know root password. Thats why i asked.
Any way thnx to all of u.

Which leads us to conclude that you were not supposed to be doing what you were trying to do.......

If that's correct, then please do not post a question like this again.

If I have made the wrong conclusion, please explain and there will be a full apology....

Good luck regardless....:)

Tinkster 08-17-2009 12:11 PM

I *hope* that the fact that he can "sudo bash" means he's got
rightful access to the root account.

pixellany 08-17-2009 12:14 PM

Quote:

Originally Posted by Tinkster (Post 3646801)
I *hope* that the fact that he can "sudo bash" means he's got
rightful access to the root account.

It was not obvious, the way I read it.
To me, the "body language" says he was trying to do something he was not suppossed to.......As I said, if he clarifies this, I will totally apologize, recant, etc.........

anomie 08-17-2009 06:58 PM

Even if he's a full sudoer, the real sysadmin probably wouldn't appreciate him trying to crack root's password. (I know I wouldn't.) For that matter, he may get a stern talking to for doing things like sudo bash.

sundialsvcs 08-17-2009 08:17 PM

There are always legitimate ways to do what legitimately must be done. If you're working with remote transfer of files, you might have to move the files to the target machine, log on to that machine, and from there move them to their final location, chown them and so-forth.

These "restrictions" are imposed for a very good reason: to constrain what a not-so-nice person can potentially "do to your system from a distance." For legitimate users they are but a slight inconvenience.

"Cracking passwords" is never the right thing to do, even if you find that you can do it. The configuration of a computer system is a surprisingly delicate thing that is very easy to break; damned difficult to repair.

chrism01 08-17-2009 08:48 PM

Just to add that there's nothing wrong with 'sudo bash'; either you've been given rights in sudoers to do that (in which case its been blessed by the sysadmin) or you haven't, in which case it'll fail.
Definitely agree with NOT trying to crack anyone's passwd, especially root.


All times are GMT -5. The time now is 11:49 PM.