You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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,
The text was updated successfully, but these errors were encountered:
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 asmy_user
, but redirections or pipes in the script belonged toroot
. But if I justsudo -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 tomy_user
, now belonged toroot
.I didn't look into the code, but this sounds magical to me.
Regards,
The text was updated successfully, but these errors were encountered: