![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
||||
|
||||
|
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
There are, for sure, better ways to do it, but that's a starting point, don't you think? Regards. |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
||||
|
||||
|
But, what do you want to do?
Give us an example. |
|
#7
|
|||
|
|||
|
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. |
|||
| Google The UNIX and Linux Forums |