Sponsored Content
Operating Systems AIX How to check password expiry in AIX? Post 302273407 by aixylinux on Sunday 4th of January 2009 01:29:29 PM
Old 01-04-2009
Use passwdexpired system call

If you can write a C program, you can call the passwdexpired() system call to get this information. See:

Help -

Here's a code fragment that does the trick. Unfortunately, due to employer restrictions, I can't share the whole code with you. I hacked this out of an existing module, so it is illustrative only.

/* typical includes needed by C programs */
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <time.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>

/* this is the include needed for passwdexpired */
#include <usersec.h>

void main( int argc, char* argv[]) {
char* userid=argv[1];

char p[100] = "";
int rc;

rc = putenv( "LANG=C" ); /* force LANG=C */

/* get password date expiration string */
rc = passwdexpired( userid, &p );
if ( rc == 1 || rc == 2 )
{
printf( "%s\nReset the password \n", p);
exit( 2 );
}

/* some other error */
if ( rc != 0 )
{
if ( errno == ENOENT || errno == ESRCH )
{
fprintf( stderr, "User %s is not defined\n", userid );
}
else
{
fprintf( stderr, "passwdexpired() rc=%d, %s\n", rc, strerror(errno) );
}
exit( 1 );
}

printf( "passwdexpired returned message:\n'%s'\n", p );

}

The binary file must be setuid root, else root must run the program.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

password expiry

Hi, under SUN Unix, in which file the expiry date of a user password is indicated ? Many thanks. (2 Replies)
Discussion started by: big123456
2 Replies

2. Solaris

Notification of password expiry.

Hi, Is there any way of sending an email to a number of users indicating that the passwords of user accounts will expire? Currently we have a test server with a number of oracle test accounts on it. Each of these accounts correspond to an instance of Oracle on the server. These... (2 Replies)
Discussion started by: sparcman
2 Replies

3. Solaris

Notification of password expiry.

Hi, Is there any way of sending an email to a number of users indicating that the passwords of user accounts will expire? Currently we have a test server with a number of oracle test accounts on it. Each of these accounts correspond to an instance of Oracle on the server. These... (2 Replies)
Discussion started by: sparcman
2 Replies

4. Solaris

SSH Password-less login fails on password expiry.

Hi Gurus I have a few Sol 5.9 servers and i have enabled password less authentication between them for my user ID. Often i have found that when my password has expired,the login fails. Resetting my password reenables the keys. Do i need to do something to avoid this scenario or is this... (2 Replies)
Discussion started by: Renjesh
2 Replies

5. Shell Programming and Scripting

password expiry notification

Hi, Could someone please let me know how to write script for passwd expiry notification on salaries boxes. Regards Dnyan (1 Reply)
Discussion started by: dnyan
1 Replies

6. Solaris

disable password expiry

Hi How do i disable password expiration on ldap? It runs on Solaris 10 machine. Thanks in advance. (3 Replies)
Discussion started by: hrist
3 Replies

7. Shell Programming and Scripting

Password expiry date check for hp servers

Hi All, Can anybody help me, to find the command to check for the password expiry date for the hp servers. Thanks, Deepak (3 Replies)
Discussion started by: dswain
3 Replies

8. Shell Programming and Scripting

Password expiry report

Hi All, I want to write a script that will send the alert when linux server password expiry for user 'x' is less than 12 days. I have written the below script but this is not working for expiry date 04 july script;- P_EXPIRY_DATE=`chage -l msdp| grep 'Password expires' | awk ' {... (2 Replies)
Discussion started by: abhigrkist
2 Replies

9. Solaris

Command to find out password expiry

Hi, I would like to know is there command which will tell me when password will be expire and when last password was changed ? like on linux chage -l <username? (2 Replies)
Discussion started by: manoj.solaris
2 Replies

10. AIX

UNIX cmd to check for non expiry type password

Hi, Here's the version of unix that we are working on. > uname -a AIX yyyyyyyy 1 6 00F613E24C00 @:on(cluster303)/iishomea/kmani00-> i have application id: aaabbb Now i need to check whether the password for the application id set to non expiry type or not. Moreover, with that unix... (3 Replies)
Discussion started by: kmanivan82
3 Replies
PWSCORE(1)						      General Commands Manual							PWSCORE(1)

NAME
pwscore - simple configurable tool for checking quality of a password SYNOPSIS
pwscore [user] DESCRIPTION
pwscore is a simple tool for checking quality of a password. The password is read from stdin. The tool uses the libpwquality library to perform configurable checks for minimum length, dictionary checking against cracklib dictionar- ies, and other checks. It either reports an error if the password fails any of the checks, or it prints out the password quality score as an integer value between 0 and 100. The password quality score is relative to the minlen setting in the configuration file. But in general values below 50 can be treated as moderate quality and above it fairly strong quality. Any password that passes the quality checks (especially the mandatory cracklib check) should withstand dictionary attacks and scores above 50 with the default minlen setting even fast brute force attacks. OPTIONS
The first and only optional argument is the user name that is used to check the similarity of the password to the username. FILES
/etc/security/pwquality.conf - The configuration file for the libpwquality library. RETURN CODES
pwscore returns 0 on success, non zero on error. SEE ALSO
pwscore(1), pwquality.conf(5), pam_pwquality(8) AUTHORS
Tomas Mraz <tmraz@redhat.com> Red Hat, Inc. 10 Nov 2011 PWSCORE(1)
All times are GMT -4. The time now is 06:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy