код такой.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/inotify.h>
#define BUF_LEN 128
int main ( int argc, char *argv[] )
{
	int passwd;
	if ( ( passwd = inotify_init1 ( 0 ) ) == -1 ){
		perror ( "inotify_init" );
		exit ( EXIT_FAILURE );
	}
	/* добавить стражей */
	int ret;
	ret = inotify_add_watch ( passwd, "/etc/shadow", IN_ALL_EVENTS );
	if ( ret == -1 ){ perror ( "passwd" ); }
	ssize_t len, i = 0;
	char buf[ BUF_LEN ] __attribute__((aligned(4)));
	while ( 1 ) {
		i = 0;
		len = read ( passwd, buf, BUF_LEN );
		while ( i < len ) {
			struct inotify_event *event = (struct inotify_event *) &buf[i];
			printf ("пароль");
			i += sizeof ( struct inotify_event ) + event->len;
		}
	}
}



