incron icon indicating copy to clipboard operation
incron copied to clipboard

Funny tool: who is doing what?

Open e-gaulue opened this issue 5 years ago • 0 comments

Dear all,

I spent a little bit of time on incron, trying to use it as cron. In cron, you can specify a user to execute the command, here you can't, but any user can add incrontab.

So to start with I did system incron. Following the cron logic, I wanted my script to be run by a specific user, so I did: /.../my_file IN_CLOSE_WRITE sudo -u my_user my_bash. This results into every command in bash script executed as my_user, but redirections or pipes in the script belonged to root. But if I just sudo -u my_user my_bash in my shell, everything is alright.

Then I switched to user incron. So: /.../my_file IN_CLOSE_WRITE my_bash set by user my_user. Same results.

So I tried /.../my_file IN_CLOSE_WRITE sudo -u my_user my_bash through user incron set by my user. It's nearly good. But in my script, I've got an unzip command, and now the unzipped file that before belonged to my_user, now belonged to root.

I didn't look into the code, but this sounds magical to me.

Regards,

e-gaulue avatar Jan 30 '20 10:01 e-gaulue