The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > AIX
Google UNIX.COM


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How To Read A File Remotely Without A Password? Korn0474 Shell Programming and Scripting 0 03-12-2008 08:55 AM
ls while read loop - internal read picking up wrong input dkieran Shell Programming and Scripting 2 05-14-2007 12:02 PM
read a part of information from txt and put into the script happyv Shell Programming and Scripting 18 10-27-2006 07:46 AM
how can i send via SFTP information with my password encrypted? irasela SUN Solaris 1 01-26-2006 06:29 AM
Change password by pushing encrypted password to systems benq70 UNIX for Dummies Questions & Answers 1 09-02-2005 06:08 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-27-2006
Registered User
 

Join Date: Apr 2006
Posts: 18
Help me - How to read password information on the AIX

Hi,
Does any body know how to read password information attributes of the user like minimun expire date, max expire date, warning date on the AIX machine.

Actually i need to show a appropriate message to the user by reading data from USER file in AIX where the information related to user password is stored the links for the details is http://www.unet.univie.ac.at/aix/fil...htm#MNM220frit

Please suggest me how can it be done ASAP.

Last edited by me_haroon; 06-27-2006 at 08:29 AM. Reason: Changes
Reply With Quote
Forum Sponsor
  #2  
Old 06-28-2006
Registered User
 

Join Date: Jun 2006
Posts: 6
Suggest trying the lsuser command, syntax:

lsuser someuser

To make things easier one entry per line:

lsuser someuser | tr " " "\n"

For system defaults use:

lsuser default

To see when user last updated their password (in Unix time - seconds elapsed since Jan 1 1970), issue (as root or member of the security group):

pwdadm -q someuser

Minage, maxage etc. are expressed in weeks, so minage=1 means that the user must wait at least 1 week between changing passwords. Password warn expressed in days.


bOOtnix
Reply With Quote
  #3  
Old 06-28-2006
Registered User
 

Join Date: Apr 2006
Posts: 18
shell scripts to read selected data from the text file.

Hi,

The information of the password ageing of an user is stored in /etc/security/user file in AIX and the format in which the attributes are stored are in text format please look into this link for more detrails :

http://www.unet.univie.ac.at/aix/fil...htm#MNM220frit

The actual problem is I dont know how to write shell scripts to read selected data from the text file. I want minage, maxage, expires attribute data from the /etc/security/user.

Can anybody help me the shellscript that accomplishes this job.

Thanks
Haroon
Reply With Quote
  #4  
Old 06-29-2006
grial's Avatar
El UNIX es como un toro
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Hi.
Here you are one very rudimentary way to do what you want:
Code:
#!/bin/bash


FILE=/etc/security/user

USR="${1}:"

cat $FILE | while read l; do
   if [[ $FOUND = true ]]; then
      if [[ $l != "" ]]; then
         FIELD=$(echo $l | awk '{print $1}')
         case $FIELD in
         minage)
            VALUE=$(echo $l | awk '{print $3}')
            echo "   ${FIELD}: $VALUE";;
         maxage)
            VALUE=$(echo $l | awk '{print $3}')
            echo "   ${FIELD}: $VALUE";;
         expires)
            VALUE=$(echo $l | awk '{print $3}')
            echo "   ${FIELD}: $VALUE";;
         esac
      else
         FOUND=false
      fi
   fi
   if [[ $l = $USR ]]; then
      echo "$USR"
      FOUND=true
   fi
done
This script reads the file line by line searching for the user. Once the user has been found, continues reading and searching for the fields you are interested in, and if they're found, prints them and their value. Then continues reading till the EOF.

There are, for sure, better ways to do it, but that's a starting point, don't you think?

Regards.
Reply With Quote
  #5  
Old 06-29-2006
Registered User
 

Join Date: Apr 2006
Posts: 18
Hi,

I wanna run "lsuser -c -a minage maxage pwdwarntime ALL" and "awk 'match($0,"username@email.com") == 0 {print $0}' FILENAME > NEWFILENAME" in a shell script. I dont know how to run this AIX commands in a shell script. Can anyone please tell me how is this to be done.

Thanks
Haroon
Reply With Quote
  #6  
Old 06-29-2006
grial's Avatar
El UNIX es como un toro
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
But, what do you want to do?
Give us an example.
Reply With Quote
  #7  
Old 06-29-2006
Registered User
 

Join Date: Apr 2006
Posts: 18
Hi,

I am doing a project on password aging to display the warning message to the user from front end i need to get information of password saying when the password expires etc. In order to read data of shadow file the user should be a "Root", which he is not. Hence i run a shell script by scheduling it into a CRON tab which collects the password information for all the users into a temporary file. THen i read data from the temporary file and display the appropriate mesasge to the user.
Hence i am thinking that
lsuser -c -a minage maxage pwdwarntime ALL" and
"awk 'match($0,"username@email.com") == 0 {print $0}' FILENAME > NEWFILENAME"

this commands will write required data to temporary file in the script.

Main Aim is to read username,minage,maxage,pwdwarntime from /etc/security/user and write to temporary file with semi colon separated format
username:minage:maxage:pwdwarntime

Please suggest me can it be done or their any other ways to do that.

Thanks
Haroon

Last edited by me_haroon; 06-29-2006 at 06:32 AM.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0