Forums

stassen
stassen
Offline
Resolved
0 votes
To make my life easy, I scheduled a cronjob for user flexshare

in /var/spool/cron/flexshare

0 12 * * 0 /install/script/recordingstart.sh

Cron.log

Nov 21 12:00:01 CROND[29827]: (flexshare) CMD (/install/script/recordingstart.sh)
Nov 21 12:00:01 CROND[29827]: (CRON) ERROR chdir failed (/dev/null): Not a directory

I did create a local home directory for flexshare

/home/flexshare (owner flexshare), but did does not do the job,., With user root everything is working as designed,

Any ideas ?
In Users
Sunday, November 21 2021, 01:32 PM
Share this post:
Responses (5)
  • Accepted Answer

    Sunday, November 21 2021, 05:45 PM - #Permalink
    Resolved
    0 votes
    Does the user "flexshare" have access to any commands? He is not root. Why run as user flexshare and not root?
    The reply is currently minimized Show
  • Accepted Answer

    stassen
    stassen
    Offline
    Sunday, November 21 2021, 07:17 PM - #Permalink
    Resolved
    0 votes
    If I run this as root, the script stores the content as root. Not a problem, but when I access this flexshare as a normal user, I don't have the "root" rights to delete or rename this item. Running this script with user flexshare eliminates this issue. BTW if I start the cronjob manually (I use webmin to start that job), this is working fine also. But if started via cron itself I have this issue.
    The reply is currently minimized Show
  • Accepted Answer

    Sunday, November 21 2021, 07:52 PM - #Permalink
    Resolved
    0 votes
    Ouch. If it is a single share, you could possibly investigate the SetUID or SetGID bit. Or can you put a recursive "chown" or "chuser"/"chgrp" at the end of your cron job? Otherwise you'll need to investigate giving "flexshare" some of root's permissions in /etc/sudoers or under /etc/sudoers.d/. The second option is probably the easiest. You wouldn't even need your flexshare user as you could use a proper user and/or group.
    The reply is currently minimized Show
  • Accepted Answer

    stassen
    stassen
    Offline
    Monday, November 22 2021, 08:23 AM - #Permalink
    Resolved
    0 votes
    Nick Howitt wrote:

    Ouch. If it is a single share, you could possibly investigate the SetUID or SetGID bit. Or can you put a recursive "chown" or "chuser"/"chgrp" at the end of your cron job? Otherwise you'll need to investigate giving "flexshare" some of root's permissions in /etc/sudoers or under /etc/sudoers.d/. The second option is probably the easiest. You wouldn't even need your flexshare user as you could use a proper user and/or group.


    After more investigation and tests, I decided to plan a chown on that particular directory at the end of every day ;-) . Thanks for helping again !
    The reply is currently minimized Show
  • Accepted Answer

    Monday, November 22 2021, 08:46 AM - #Permalink
    Resolved
    0 votes
    stassen wrote:
    After more investigation and tests, I decided to plan a chown on that particular directory at the end of every day ;-) . Thanks for helping again !
    Just do it as part of the cron job e.g:
    0 12 * * 0 /install/script/recordingstart.sh; chown user:group {folder} -R
    The reply is currently minimized Show
Your Reply