Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The /etc/shadow file contains an id of $1$, $2$, $5$ or $6$ to show the encryption method used. A salt follows this, followed by the password hash. When a user is created and a password is set, a hash is RANDOMLY generated and used as the salt to the password hash. Everytime that user logs in, login checks /etc/shadow for the $id$ and salt and runs the password given by the user through the hash mechanism ($id$) using the salt in /etc/shadow.
So basically does login look at /etc/shadow for the $id$ and salt to create a hash with which to compare to the /etc/shadow hash?
question 2 - If my $id$ was $5$, which is sha256, how would i go about changing this? Like is there a shadow.conf or crypt.conf or something? Can i change it per user?
The /etc/shadow file contains an id of $1$, $2$, $5$ or $6$ to show the encryption method used. A salt follows this, followed by the password hash. When a user is created and a password is set, a hash is RANDOMLY generated and used as the salt to the password hash. Everytime that user logs in, login checks /etc/shadow for the $id$ and salt and runs the password given by the user through the hash mechanism ($id$) using the salt in /etc/shadow.
So basically does login look at /etc/shadow for the $id$ and salt to create a hash with which to compare to the /etc/shadow hash?
question 2 - If my $id$ was $5$, which is sha256, how would i go about changing this? Like is there a shadow.conf or crypt.conf or something? Can i change it per user?
Thank you
Just after a quick once over that looks correct.
Some distros have a command which will change all the appropriate files for you, but in a nutshell you will need to change PAM and the system itself.
Take a look at (again may be different in other distros):
/etc/pam.d/password
/etc/default/password
/etc/login.defs
After you change the type of hash, you will have to regenerate the password hashes for your users.
Some distros have a command which will change all the appropriate files for you, but in a nutshell you will need to change PAM and the system itself.
That's right. It is a good idea to include your distro / version in your initial post.
Quote:
Originally Posted by nomb
After you change the type of hash, you will have to regenerate the password hashes for your users.
Just to add some clarity: the original (pre-change) hash will still be supported in the sense that users with existing passwords should still be able to authenticate. But any passwd(1) changes from that point (post-change) going forward will use the new hash. You could conceivably have a shadow(5) file that contains users with both hash types.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.