Sponsored Content
Full Discussion: Check password strength
Top Forums UNIX for Dummies Questions & Answers Check password strength Post 302424947 by pseudocoder on Wednesday 26th of May 2010 05:05:19 PM
Old 05-26-2010
Quote:
Originally Posted by petel1
Ok i have done everything by now,
Is this script meant only for fun and just checking if the provided password matches the criteria or is it also passing the "strong" password to passwd command and a password change is done? If it's latter, please post your code, because I'm very curious Smilie

Quote:
Originally Posted by petel1
the only thing thats bugging me is how can i check how many
numbers a string contains, it should have at least two.
Code:
$ ./readpass.sh
Password: abcdef
EPIC FAIL! Password has not even one digit!
$ ./readpass.sh
Password: abcde3
FAIL! Need at least 2 digits!
$ ./readpass.sh
Password: 1abcde2
PASS! I could find at least 2 digits.
$

Code:
#!/bin/sh

#stty -echo

echo -n "Password: "
read pass

#stty echo

count=$(echo $pass | sed 's/[^0-9]//g')
echo $count | grep -o '[0-9]' >/dev/null

if [ $? != 0 ]; then
 echo "EPIC FAIL! Password has not even one digit!"
 exit
fi

count=$(printf $count | wc -c)

if [ $count -lt 2 ]; then

 echo "FAIL! Need at least 2 digits!"
 exit

 else

 echo "PASS! I could find at least 2 digits."
 exit

fi

Uncomment the two lines above, if you want the password *not* to be echoed (Recommended).
 

9 More Discussions You Might Find Interesting

1. Programming

check root password

hai Friends How can i check the root password of a linux system using a c program or with some shell script... I have seen many tools like webmin that authenticates the user using the root password... How do they do that... Pls help... Thanks in advance Collins (1 Reply)
Discussion started by: collins
1 Replies

2. UNIX for Dummies Questions & Answers

Password safe encryption strength

I'm not sure if this is the right forum for this or not but we use a program called "Password Safe" to store the many root passwords we have for our Unix system. Now we are being called out by our security team to prove that this is a safe program to use. So far I have been able to determine... (1 Reply)
Discussion started by: keelba
1 Replies

3. UNIX for Dummies Questions & Answers

password check

Hi While using Pipe concept ,if a user enters a "login name" and "paswword" ,then how does a child process check for user password is correct or not and give notification to parent process. (1 Reply)
Discussion started by: riya
1 Replies

4. Shell Programming and Scripting

Check password age

Hi Guys, I hope one of you has already done this and is kind enough to share your script with me. I have a Solaris8 server that uses password aging for its local user accounts. I need a script that checks the age of the password and then sends the user an email if the password is about to... (3 Replies)
Discussion started by: Tornado
3 Replies

5. Shell Programming and Scripting

How can I check that a password is correct?

Hi there, There's something I don't understand. The same string does not give the same md5 hash everytime. I wanted to find a way to check someone's password but the following script obviously shows that it's not possible that way : ks354286:~# user=foo ks354286:~# pw=$(mkpasswd -H md5... (3 Replies)
Discussion started by: chebarbudo
3 Replies

6. Cybersecurity

Periodic check of user password strength

I need to periodically run a check on the passwords of the users (Redhat 5.0) to verify that all passwords meet minimal standards. I remember seeing a script years ago that grabbed the encrypted passwords from the file and checked if they matched any of the encrypted strings in another file, plus... (1 Reply)
Discussion started by: tlynnch
1 Replies

7. Solaris

Check when password expires

How do I check to see when a password expires on a user account with using the CLI? (1 Reply)
Discussion started by: jastanle84
1 Replies

8. AIX

How to find TX and RX strength?

I have an AIX server running 6.1. My SAN switch is reporting that it is only receiving 5.9 uWatts (micro watts) and it should be well over 100 uWatts. How can I see the transmit strength of my fiber card from within AIX? I have Emulex fiber cards. (1 Reply)
Discussion started by: kah00na
1 Replies

9. Cybersecurity

Openssl cipher strength

I have read the forums for strengthing the openssl ciphers on a server and the following command I can run: openssl ciphers -v 'TLSv1+HIGH:!SSLv2:RC4!MEDIUM:!aNULL:!eNULL:!3DES:!EXPORT:@STRENGTH' I have some services that cannot be set to higher levels like you can set in an httpd.conf file.... (1 Reply)
Discussion started by: hydrashok158
1 Replies
pam_sm_chauthtok(3)					     Library Functions Manual					       pam_sm_chauthtok(3)

NAME
pam_sm_chauthtok - Service provider implementation for pam_chauthtok SYNOPSIS
[ flag ... ] file ... [ library ... ] DESCRIPTION
In response to a call to the PAM framework calls from the modules listed in the pam.conf(4) file. The password management provider sup- plies the back-end functionality for this interface function. changes the authentication token associated with a particular user referenced by the authentication handle, pamh. The following flag may be passed in to The password service should not generate any messages. The password service should only update those passwords that have aged. If this flag is not passed, the password service should update all passwords. The password service should only perform preliminary checks. No passwords should be updated. The password service should update passwords. Note that and can not be set at the same time. Upon successful completion of the call, the authentication token of the user will be ready for change or will be changed (depending upon the flag) in accordance with the authentication scheme configured within the system. The argc argument represents the number of module options passed in from the configuration file pam.conf(4). argv specifies the module options, which are interpreted and processed by the password management service. Please refer to the specific module man pages for the various available options. It is the responsibility of to determine if the new password meets certain strength requirements. may continue to re-prompt the user (for a limited number of times) for a new password until the password entered meets the strength requirements. Before returning, should call and retrieve both and If both are NULL, should set them to the new and old passwords as entered by the user. APPLICATION USAGE
Refer to pam(3) for information on thread-safety of PAM interfaces. NOTES
The PAM framework invokes the password services twice. The first time the modules are invoked with the flag, During this stage, the pass- word modules should only perform preliminary checks (ping remote name services to see if they are ready for updates, for example). If a password module detects a transient error (remote name service temporarily down, for example) it should return to the PAM framework, which will immediately return the error back to the application. If all password modules pass the preliminary check, the PAM framework invokes the password services again with the flag, During this stage, each password module should proceed to update the appropriate password. Any error will again be reported back to application. If a service module receives the flag, it should check whether the password has aged or expired. If the password has aged or expired, then the service module should proceed to update the password. If the status indicates that the password has not yet aged/expired, then the password module should return If a user's password has aged or expired, a PAM account module could save this information as state in the authentication handle, pamh, using The related password management module could retrieve this information using to determine whether or not it should prompt the user to update the password for this particular module. RETURN VALUES
Upon successful completion, must be returned. The following values may also be returned: No permission. Authentication token manipulation error. Old authentication token cannot be recovered. Authentication token lock busy. Authentication token aging disabled. User unknown to password service. Preliminary check by password service failed. SEE ALSO
pam(3), pam_chauthtok(3), pam.conf(4). pam_sm_chauthtok(3)
All times are GMT -4. The time now is 02:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy