Find the answer to your Linux question:
Results 1 to 5 of 5
I need help on creating a script which evaluates whether or not the passwd file has changed....
  1. #1
    Just Joined!
    Join Date
    Apr 2010
    Posts
    2

    script to evaluate if a passwd file has changed

    I need help on creating a script which evaluates whether or not the passwd file has changed.
    Last edited by Piston4; 04-06-2010 at 01:32 PM. Reason: figured out other portion of the script

  2. #2
    Just Joined! sathiya's Avatar
    Join Date
    Feb 2008
    Location
    Bangalore, India
    Posts
    97
    There is more than one way to do it.

    One of it is, find out the md5sum of the passwd file and write it somewhere. From the second invocation find and compare the md5sum which will tell you whether there is a change or not ?!

    Do it in the programming language you know.. Hope it helped.

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    If you want to do this in real time, then look at the inotify subsystem. You can either write your own application to do this, or use the inotifywait/inotifywatch system commands to detect changes in /etc/passwd (account information), /etc/group (group memberships), and /etc/shadow (where the actual passwords are kept).
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. #4
    Just Joined!
    Join Date
    Apr 2010
    Posts
    2
    Thanks rubberman that helped me alot!

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Happy to help. I've just recently become aware of these capabilities when I had such a need to detect when certain files were updated in order to signal some applications that they needed to reload a database into memory for realtime processing in warehouses and assembly lines.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...