LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Script to check password security (https://www.linuxquestions.org/questions/linux-newbie-8/script-to-check-password-security-803529/)

dave12 04-22-2010 10:05 AM

Script to check password security
 
Hi,

Im trying to make a script that will test the suitability of a password. I understand that all the features I want are in the /etc/pam.d/common-password file. From here I can change the length of a password, what characters must be in a password, if the words are in the dictionary, etc... but I don't know how to change these values by using a script. I want it in a script because I want to be able to suggest a more suitable password if the original password doesn't meet the criteria.

Cheers
Dave

TB0ne 04-22-2010 10:08 AM

Quote:

Originally Posted by dave12 (Post 3944081)
Hi,

Im trying to make a script that will test the suitability of a password. I understand that all the features I want are in the /etc/pam.d/common-password file. From here I can change the length of a password, what characters must be in a password, if the words are in the dictionary, etc... but I don't know how to change these values by using a script. I want it in a script because I want to be able to suggest a more suitable password if the original password doesn't meet the criteria.

Cheers
Dave

Ok...you've said what you want, but what is your question? What are you having problems with? What have you written so far?

We'll be glad to help you with a script, but I doubt anyone is going to write it for you. Post what you've written, and where you're getting stuck, and we can assist.

dave12 04-22-2010 10:25 AM

sorry, here's what I have so far.

#!/bin/sh


echo "password required pam_cracklib.so \ minlen=6 dcredit=-1 ucredit=-1
password required pam_unix.so use_authok obscure md5 " > /etc/pam.d/common-password

This works, it changes the file to the above contents. I think i'm just confusing myself. I need to check this works against a password and if the password doesn't match these criteria I want to suggest an alternative.

dave12 04-22-2010 10:33 AM

Sorry again,

This wasnt a very good post. I don't think im going about it the right way. I need a script to give an alternative if the password doesn't meet the criteria. This script will just change the file and if I offer an alternative password in here I don't think it will work because this script won't be run everytime a new password is entered. Could anyone point me in the right direction?


All times are GMT -5. The time now is 08:38 AM.