Emergency UNIX and Linux Support

Please post your urgent questions here for highest visibility. Posting a new thread to this forum requires Bits. We monitor this forum to help people with emergencies, but we do not guarantee response time or answers. This forum is "best effort" only. Members who reply to posts here receive a bonus of 1000 Bits per reply.

User id creation/deletion - notification

👤 Login to reply

    #1  
Old 10-23-2015
ggayathri ggayathri is offline
Registered User
 
Join Date: Oct 2008
Last Activity: 23 March 2018, 9:37 AM EDT
Posts: 86
Thanks: 1
Thanked 0 Times in 0 Posts
User id creation/deletion - notification

Can someone help me with a shell script that will send an email to a set of email ids when a user id is created or deleted on AIX system.
Also, if the script can let the admin know when a particular user id's password will expire.
Sponsored Links
    #2  
Old 10-23-2015
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 21 July 2018, 2:56 AM EDT
Location: Aachen, Germany
Posts: 13,081
Thanks: 452
Thanked 4,017 Times in 3,693 Posts
Are you thinking of a (daily?) cron job? Did you check/search these fora on this exact topic?
Sponsored Links
    #3  
Old 10-23-2015
rbatte1 rbatte1 is offline Forum Staff  
Root armed
 
Join Date: Jun 2007
Last Activity: 20 July 2018, 11:57 AM EDT
Location: Lancashire, UK
Posts: 3,588
Thanks: 1,594
Thanked 706 Times in 633 Posts
Dear ggayathri,

I have a few to questions pose in response first:-
  • What have you tried so far?
  • What output/errors do you get?
  • What AIX version are you using?
  • What files are you exploring to get this information?
  • What are your preferred tools? (C, shell, perl, awk, etc.)
  • What logical process have you considered? (to help steer us to follow what you are trying to achieve)

Most importantly, What have you tried so far?

There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.


We're all here to learn and getting the relevant information will help us all.


Robin
    #4  
Old 10-23-2015
ggayathri ggayathri is offline
Registered User
 
Join Date: Oct 2008
Last Activity: 23 March 2018, 9:37 AM EDT
Posts: 86
Thanks: 1
Thanked 0 Times in 0 Posts
Hi Robin,

This is to be executed as a cron job on a daily basis. Can consider shell/awk/perl scripts as well. My thoughts have been to find the difference between the /etc/passwd file and come up with the additions/deletions. I have not tried any scripting in this regard.
Sponsored Links
    #5  
Old 10-23-2015
rbatte1 rbatte1 is offline Forum Staff  
Root armed
 
Join Date: Jun 2007
Last Activity: 20 July 2018, 11:57 AM EDT
Location: Lancashire, UK
Posts: 3,588
Thanks: 1,594
Thanked 706 Times in 633 Posts
Your suggestions could be set out as:-
  • Compare today's /etc/passwd to yesterday (sort first for ease)
  • Save current /etc/passwd to use tomorrow
You can then look for password expiry based on the content of /etc/security/password It's a little awkward because:-
  • The Last password change time is stored in seconds from 1/1/1970
  • The expiry will be in weeks, either per user or in the default stanza
Using /etc/passwd as a driver, you can read one stanza from /etc/security/passwd with grep -Ep "^$userid:" /etc/security/passwd although you then have to consider the points above to decide if the password is about to expire, depending also how you define 'about to expire'



Does this give you something to work with?

Robin
Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Notification of user id creation/deletion ggayathri Shell Programming and Scripting 2 10-23-2015 05:04 AM
User account expiration notification makauser UNIX and Linux Applications 2 10-13-2015 01:58 AM
User's deletion in OpenLDAP ghimakiran UNIX for Advanced & Expert Users 2 02-09-2010 01:15 AM
File Creation notification echchatbi UNIX for Dummies Questions & Answers 4 11-10-2009 11:32 AM
How to watch for file creation/deletion? siegfried Programming 5 11-13-2007 12:48 AM



All times are GMT -4. The time now is 07:53 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password





Not a Forum Member?
Forgot Password?