LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-18-2021, 07:38 PM   #1
androsob
LQ Newbie
 
Registered: Dec 2021
Location: Lima, Perú
Distribution: Ubuntu
Posts: 8

Rep: Reputation: Disabled
Know root password complexity


Hello everyone, I'm new to the forum, I wanted to know if there was a way to know the complexity of the root password without knowing it exactly.

I do not know if any encrypted record or file is generated that can show any indication of it.

It may seem absurd, but there are cases where we do not know the root password but we have to do a security audit on the server and I don't want to be asking for the password every time I have to check it.

Thanks, androsob
 
Old 12-19-2021, 06:08 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,143

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
The only thing stored is the hash in /etc/shadow. From the hash, you cannot tell how long the original password is or what characters it contains.
 
Old 12-19-2021, 07:16 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,596
Blog Entries: 19

Rep: Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455
There used to be a website where you could input a password and get a judgement on its complexity. But I can see why you might not want to do that with your root password!
 
Old 12-19-2021, 07:32 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,321
Blog Entries: 3

Rep: Reputation: 3725Reputation: 3725Reputation: 3725Reputation: 3725Reputation: 3725Reputation: 3725Reputation: 3725Reputation: 3725Reputation: 3725Reputation: 3725Reputation: 3725
Welcome.

Hashes are oneway, so without knowing the password, you can't tell without lots and lots of work. Furthermore, the password hash in /etc/shadow is salted for you. So you'd have to take the salt into account before you try going to the trouble of making a list of possible matching hashes using John the Ripper.

It'd be more practical just to reset the root password to something known good. You can easily make a good one by hand, but there are various utilities to either make or evaluate passwords. Cracklib is an example of the latter. While pwdgen is one example of many of the former, generating passwords is easy enough that you can make a good one with a few lines of perl, python, ruby, or whatever.

Last edited by Turbocapitalist; 12-19-2021 at 07:33 AM.
 
Old 12-19-2021, 08:39 AM   #5
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,609

Rep: Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553
Quote:
Originally Posted by hazel View Post
There used to be a website where you could input a password and get a judgement on its complexity. But I can see why you might not want to do that with your root password!
You're probably referring to zxcvbn, which is a JavaScript library intended for use on registration pages - there is a demo of it in use which is safe so long as the relevant GitHub repo is not compromised.

The safer option is to download it and use it locally (again, after verifying there is no tampering to add remote requests in the code).


This doesn't solve the not-knowing-the-password problem - but it could be provided to the people that do know it, and asking them to verify the passwords they're responsible for and change any that come below a certain strength rating.

 
Old 12-19-2021, 09:06 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,895

Rep: Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317
Quote:
Originally Posted by androsob View Post
I wanted to know if there was a way to know the complexity of the root password without knowing it exactly.
No, there is no way to know the complexity of any password without knowing that password.

I do not know if any encrypted record or file is generated that can show any indication of it.
Quote:
Originally Posted by androsob View Post
It may seem absurd, but there are cases where we do not know the root password but we have to do a security audit on the server and I don't want to be asking for the password every time I have to check it.

Thanks, androsob
The usual case is to check the complexity when you set it (and does not allow to set simple ones).
You can use this: https://www.cyberciti.biz/security/l...ength-checker/
or probably even better: https://www.networkworld.com/article...-on-linux.html
Actually manually checking those passwords is not really acceptable nowadays. Security audits should not accept it at all.
 
Old 12-19-2021, 12:44 PM   #7
androsob
LQ Newbie
 
Registered: Dec 2021
Location: Lima, Perú
Distribution: Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thank you all for your response. I say this because we recently went through a security audit and the entire process of gathering the requested information was quite tedious.

But the absurd thing is that they ask you for records of everything, but they do not audit something as basic as the complexity of the root password.

So since I'm from security, I wanted to know if there was any way to detect a possible insecure key and recommend to the infrastructure area to correct them.
 
Old 12-19-2021, 03:20 PM   #8
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,609

Rep: Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553

One thing you can tell from the hash is the algorithm used.

Code:
sudo cat /etc/shadow | egrep -o '^[^:]+:\$[^$]+\$'
This will most likely output rows like "root:$6$" - if you get any that contain "$1$" then that user's password is hashed by a now insecure algorithm - you need to check/fix the default, then require that user to change their password.

 
2 members found this post helpful.
Old 12-20-2021, 11:09 AM   #9
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
You need to (visually) look at the root password.
If it is fails typical recommendations for a good password, then it is a fail.

In addition, check passwords for any admin users where sudo gives root authority.

Quote:
Originally Posted by boughtonp View Post
One thing you can tell from the hash is the algorithm used.

Code:
sudo cat /etc/shadow | egrep -o '^[^:]+:\$[^$]+\$'
This will most likely output rows like "root:$6$" - if you get any that contain "$1$" then that user's password is hashed by a now insecure algorithm - you need to check/fix the default, then require that user to change their password.
$1 = MD5 hashing algorithm very insecure
$2 =Blowfish Algorithm is in use.
$2a=eksblowfish Algorithm
$5 =SHA-256 Algorithm
$6 =SHA-512 Algorithm
 
Old 12-20-2021, 12:49 PM   #10
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,609

Rep: Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553
Quote:
Originally Posted by JeremyBoden View Post
$1 = MD5 hashing algorithm very insecure
$2 =Blowfish Algorithm is in use.
$2a=eksblowfish Algorithm
$5 =SHA-256 Algorithm
$6 =SHA-512 Algorithm
"$1$" is not MD5, it's md5crypt. That's not pedantry - there is a difference. (Not enough to stop it being insecure, but still a difference.)

On the same note, the difference between "$6$" (sha512crypt) and SHA-512 is enough to make "$6$"/sha512crypt adequate (for the time being), despite SHA-512 algorithm itself being a bad choice for passwords. (Also important to state that sha512crypt is different to "SSHA-512", which is another poor choice.)

"$2$" and "$2a$" and "$2b$" are different versions of the same algorithm (bcrypt, aka Blowfish-based crypt, which uses the Eksblowfish cipher). There's also unofficial prefixes "$2x$" and "$2y$" from PHP's implementation.

Some other notable ones are "$7$" for scrypt, "$y$" for yescrypt, and Argon2 has four variants "$argon2i$" and "$argon2d$" and "$argon2ds$" and "$argon2id$" which each have benefits against different threat types.

 
1 members found this post helpful.
Old 12-20-2021, 01:52 PM   #11
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
What all the above points out is that there are 2 factors affecting password complexity.

First is the password itself. Is it easy to guess? or will it take a massive brute force attempt to guess it? The attack would need to use the same 'salt' and the same algorithm to hash each attempt then compare the result to the stored encrypted password to verify if the guess succeeded or failed.

The second is the algorithm used by the system to hash/encrypt it and some are better than others.
 
Old 12-20-2021, 04:15 PM   #12
androsob
LQ Newbie
 
Registered: Dec 2021
Location: Lima, Perú
Distribution: Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
Because of my position I don't manage root passwords, but when I found out about some I almost ripped my eyes out hahaha

The issue that I do not want to be bothering when asking server by server what the password is, but from my position to audit the possible easy keys and recommend their change.
 
Old 12-21-2021, 02:05 AM   #13
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,895

Rep: Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317
Because of your position you need not know those passwords at all. So you can [force to] set a mechanism to check passwords automatically (programmatically). You (or the audit) can check if that mechanism exists and sufficient and you can force the responsible admins to change those passwords (see post #6 again and the links).
 
Old 12-21-2021, 07:27 AM   #14
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
If you have root access, you can override any automated password checker.
If you really want to set the root password to 'password', you can.
 
Old 12-21-2021, 08:01 AM   #15
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,895

Rep: Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317
Quote:
Originally Posted by JeremyBoden View Post
If you have root access, you can override any automated password checker.
If you really want to set the root password to 'password', you can.
actually root always has the possibility to "overrule" any solution (or any rule). But that is another story.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
setting password complexity not working as root cheersvega Linux - Server 1 08-24-2012 01:22 AM
bash script to test string complexity (like password complexity) robertjinx Linux - Server 2 05-12-2010 02:58 PM
[SOLVED] root password complexity enforcement ErnieG Linux - Security 3 05-05-2010 06:45 AM
Howto change system password policies (passwd length, complexity) tisource Linux - Security 3 09-06-2005 12:01 AM
Linux PAM minimum password and complexity reemo73 Linux - Software 3 06-01-2005 03:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration