Have users changed their password


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Have users changed their password
# 1  
Old 09-18-2006
Have users changed their password

How can I know users have changed their passwords ? I don't need their password (!) I have to know if they have changed their pass word and when ?
Thank you in advance for any SIMPLE answer.
# 2  
Old 09-18-2006
Simplest answer: man shadow

The third field in /etc/shadow tells you when the user last changed their password (hence the field name of lastchg Smilie ). The value is the number of days since Jan 1, 1970 that the password was last modified.

Carl
# 3  
Old 09-18-2006
What system are you using? Some systems ( HP-UX ) store password aging information in the password field of the /etc/passwd file. It will be stored after the encrypted password, will be 4 characters long, and separated from the encrypted password by a comma ( , ).

For example,
Code:
mysql:Z16RrGHU3/vcc,4/k6:27:27:MySQL Server:/var/lib/mysql:/bin/bash
cshuser:Z16RrGHU3/vcc,4/..:506:506::/home/cshuser:/bin/csh

It depends on the system you are using. Also, 'man passwd' may also help. I apologize if this isn't a simple answer.
# 4  
Old 09-18-2006
Quote:
Originally Posted by nathan
What system are you using? Some systems ( HP-UX ) store password aging information in the password field of the /etc/passwd file. It will be stored after the encrypted password, will be 4 characters long, and separated from the encrypted password by a comma ( , ).

For example,
Code:
mysql:Z16RrGHU3/vcc,4/k6:27:27:MySQL Server:/var/lib/mysql:/bin/bash
cshuser:Z16RrGHU3/vcc,4/..:506:506::/home/cshuser:/bin/csh

It depends on the system you are using. Also, 'man passwd' may also help. I apologize if this isn't a simple answer.
Good point. I just started supporting HP-UX and we have a couple of systems like this.

Carl
# 5  
Old 09-19-2006
Hello
Thank you for your answers.
I am working with AIX 5L 5.3
I found "lastupdate" in /etc/security/passwd. It's the time in second since Jan 1, 1970 when the password was last changed.
Now I just have to calculate the time (day, month, hour ...) with this "lastupdate"
Have anybody got an idea ?
Thank you
Anne
# 6  
Old 09-20-2006
I wrote a perl script to do it. I don't know of any standard UNIX utilities. Get a manual on localtime for more information. ( "man localtime" ).

Code:
$ cat $(which long2date)
#!/usr/bin/env perl

use File::Basename;
usage() if( !$ARGV[0] );

$long = $ARGV[0] if ( $ARGV[0] );

#  0    1    2     3     4    5     6     7     8
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime( $long );
$year+=1900;$mon+=1;

$datestr = sprintf( "%04d-%02d-%02d %02d:%02d:%02d" ,
                    $year,
                    $mon,
                    $mday,
                    $hour,
                    $min,
                    $sec );

printf( "%s\n" , $datestr );

sub usage()
{
  $progname = basename($0);
  printf STDOUT "usage: %s <long>\n" , $progname;
  exit 1;
}


$ long2date 1158728002
2006-09-19 23:53:22

# 7  
Old 09-20-2006
That's exactly what I need :
1) where is the information --> /etc/security/passwd
2) how can I use it --> this perl script
Thank you very much all of you !
Anne
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check when the password has been changed lastly

Hi, I wanted to check when the password of a current user(logged in) has been changed recently. I tried with the commands like passwd -s name logins -x -l username everthingbut it shows not a super user Which commands will help me.. Kindly help.. Thanks in advance. (3 Replies)
Discussion started by: Pranavi
3 Replies

2. AIX

Root password changed but old one still works

Hello i am running AIX 6.1. i recently changed the root password using passwd and pwdadm. while the new password works fine, i am still able to login using the old password. is there anyway this can disabled\fixed thanks (5 Replies)
Discussion started by: dnlsingh
5 Replies

3. Shell Programming and Scripting

How to match certain users from password file?

I need to match all users starting from ab and cd. All the users are having five letters in total. ie: ab123 I tried below, but many other users with more than five letters are also appearing. I need to catch only users starting with ab & cd that has only five letters. possible? awk -F: '$1 ~... (3 Replies)
Discussion started by: wimaxpole
3 Replies

4. Solaris

Change password for users

I am on SunOS SolarisServer 5.11 11.1 i86pc i386 i86pc , I am trying to change password for a user,but I get the following message.I cannot find any google help on the matter.can anyone help? root@SolarisServer:~# passwd passwd: Changing password for stain Please try again Please try... (6 Replies)
Discussion started by: cbtshare
6 Replies

5. Red Hat

Password not changed!

Hi I am using Fedora 14. I forgot root password of Fedora 14 so I used online help from Fedora website which says by doing rheb silent 1 and then using proper kernel and then using psswd for changing the password I changed it. But after normal booting GUI I am not able to log-on. Can anybody plz... (5 Replies)
Discussion started by: nixhead
5 Replies

6. UNIX for Dummies Questions & Answers

Password last changed

Hi, I am doing an audit and thought I knew what I was doing, but reading through the posts I came into doubt. On Sun Solaris, I want to know when users last changed their passwords. I have the etc/shadow files and there is a nice field showing this. Except that it is disturbing me somewhat that... (5 Replies)
Discussion started by: Norgaard
5 Replies

7. Shell Programming and Scripting

Users who have never changed their password from /etc/shadow.

Hello, I have to do a script which returns users who have never changed their password from /etc/shadow. Here is what have I done and I'm not sure if it's ok. I tried to return just users who doesn;t have password set or are locked. Can be there other kind of user who never changed the... (3 Replies)
Discussion started by: catalint
3 Replies

8. UNIX Desktop Questions & Answers

Too many users with root password

Hi there, I'm working with a Linux server and now I can get a daily Logwatch mail ... my question is:since there are too many users with root password (...in my opinion... :mad:) how could I prevent to delete information about "su" log? Thanks in advance, GB (3 Replies)
Discussion started by: Giordano Bruno
3 Replies

9. Shell Programming and Scripting

Help- Change the password of users to common one

Hi all I have some 106 users of which i need to change the password of them to a common one. I dont know their paswword. But i need to reset them to a common one. How can i do this with a shell script? It would be a great help if some one can help to sort out this.:b::b: I know it can be... (0 Replies)
Discussion started by: Tuxidow
0 Replies

10. UNIX for Dummies Questions & Answers

Setting password restrictions for all users

I would like to change the password requirements for all our AIX 5.2 logins but am having trouble finding a place where I can set the rules for everyone at the same time. I know I can go user by user in smit passwords but is there a way to create rules for everyone at the same time? Thanks,... (2 Replies)
Discussion started by: drathbone
2 Replies
Login or Register to Ask a Question