Results 1 to 5 of 5
I need help on creating a script which evaluates whether or not the passwd file has changed....
- 04-06-2010 #1Just 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
- 04-06-2010 #2
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.
- 04-06-2010 #3Linux Guru
- 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!
- 04-06-2010 #4Just Joined!
- Join Date
- Apr 2010
- Posts
- 2
Thanks rubberman that helped me alot!
- 04-07-2010 #5Linux Guru
- 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!


Reply With Quote