0

I have incron installed on my centos 7 machine.

for my initial testing, I have a simple entry in the table. When a file is moved to the target folder, it would run a script. What I did first was to execute

/dir IN_MOVED_TO logger success

This does not work though, when I put a file in the target folder I see a message in the /var/logs/messages that says

Aug 14 23:29:27 Clone-Dev-AnalyticsAutomation gnome-session: gnome-session-binary[2329]: WARNING: Unable to inhibit system: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Permission denied
Aug 14 23:29:32 Clone-Dev-AnalyticsAutomation journal: unable to create file '/run/user/1018/dconf/user': Permission denied.  dconf will not work properly.

I thought incrond was started without the sudo command so I restarted it with the sudo command but I still get the same results.

I ran service incrond status -l

Aug 14 23:13:48 Clone-Dev incrond[6875]: loading user tables
Aug 14 23:13:48 Clone-Dev incrond[6875]: loading table for user simon
Aug 14 23:13:49 Clone-Dev incrond[6875]: loading table for user analytics
Aug 14 23:13:49 Clone-Dev incrond[6875]: loading table for user root
Aug 14 23:13:49 Clone-Dev incrond[6875]: access denied on ## - events will be discarded silently
Aug 14 23:13:49 Clone-Dev incrond[6875]: cannot create watch for user root: (22) Invalid argument
Aug 14 23:13:49 Clone-Dev incrond[6875]: access denied on ## - events will be discarded silently
Aug 14 23:13:49 Clone-Dev incrond[6875]: cannot create watch for user root: (22) Invalid argument
Aug 14 23:13:49 Clone-Dev incrond[6875]: ready to process filesystem events

I'm not really sure what's happening. I feel like incrond is trying to execute commands but does not have the necessary privileges.

chip
  • 153
  • 1
  • 3
  • 11

1 Answers1

1

The problem is not ith service or user running it, Change permission for this directory

chmod 644 /run/user/1018/dconf/user

or for the parent directory.even 777 would do if you are running from other user.

If a process that you are using(gnome-session - GDBus in this case is my guess) is having explicit gui, then check what process under dconf/user is conflicting with your dir command(in incron). and disable permission accordingly or choose to disown that process

$>pidof dconf*

$>disown --pid=<PID of conflicting process>

You need not run the service as root, it is most likely a conflict in running the process against gnome session GUI. Edit- Allow user in /etc/incron.allow to be able to run incron

Simple bash like incron setup would be

if[ IN_CREATE_DIR /run/user/1018/dconf/user ]
then
   set /dir moved
   mailx -r "server" -s "dir moved" [email protected]
fi
/dir IN_MOVED_FROM /log success

runing this should be enough, although i dont feel

Pavan Kate
  • 36
  • 3
  • I appreciate your answer, for now I will revert back to using cron since I'm in a time constraint. But I will surely try this when I get the free time. – chip Aug 15 '18 at 09:49