jamesrwhite / minicron

🕰️ Monitor your cron jobs
GNU General Public License v3.0
2.34k stars 154 forks source link

Add support for user crontabs #73

Closed jamesrwhite closed 8 years ago

Guitaraholic commented 10 years ago

Our remote systems are accessed using a personal ssh user then we 'sudo' to the application owner - in most cases the relevant cron activity we'd want to manage is for that application owner. Any idea how we'd be able to use this method with minicron OR would we be best to enable remote ssh using the pubkey only for these services?

jamesrwhite commented 10 years ago

Does sudo'ing to that user require entering a password?

If so I think setting up public key based auth for the app user is the best option. In theory the sudo method you describe could work but then either the sudo password would have to be stored in the db or some kind of interactive way of providing it for each operation you do would have to be added, neither of which sounds like a great idea to me.

And just to confirm this is for user crontabs that are in /var/spool/cron/crontabs or somewhere similar i.e not /etc/crontab?

penfold45 commented 10 years ago

I would really like to use this tool but I cannot give right access to /etc/cron and or the /etc directory.

For starters on Debian when you make /etc/crontab editable by anything other than root it will not run any cron jobs at all I suspect the same will happen for /etc/cron.d

I never make it possible to ssh in to the root account for several reasons.

I would have the same problem with /var/spool/cron/crontabs and /etc/cron.d

Any reason you cannot use the crontab file that you get when you type "crontab -e"? which is the user specific one.

jamesrwhite commented 10 years ago

I'm going to re-visit this when I get a chance. I feel like a had a reason for only using /etc/crontab but I can't remember exactly what it was.

You make some good points though which I'm well aware of.

With crontab -e it opens up whatever your $EDITOR is which isn't really going to work when I try and edit it programatically over SSH. Do you know if there's a way I can tell where the user's crontab will be located as I don't think it's standard across OS's?

I'd also need to consider how to allow for specifying which the user the job will run as, given that user crontabs don't allow you to do that.

jaygridley commented 10 years ago

I would like to encourage you in implementing this functionality. In our production environment, we have crontab located under user specific folder. The user is permitted to access only this specific folder and inside it, there is our crontab.

jamesrwhite commented 8 years ago

Done in https://github.com/jamesrwhite/minicron/pull/180