Page 1 of 1
owner crontab
Posted: Tuesday 28 November 2017 20:56
by curious
I have problems modifying and running my crontab
The filename of my crontab-file is "pi" and can be found in the folder /var/spool/crontabs/cron
When I login in as user pi on the raspberry and modify the crontab, saving fails with the error:
Code: Select all
crontab : installing new crontab
/var/spool/cron/:mkstemp:Permission denied
crontab:edits left in /tmp/crontab.BDN3RD/crontab
when i modify the crontab file in a ssh session (winscp) it will be saved.
the owner of the file "pi" is pi
It seems that user pi when logged in with ssh is another user than user "pi" when logged into the raspberry directly.
What do I have to do to get my crontab running ?
Re: owner crontab
Posted: Tuesday 28 November 2017 21:26
by Toulon7559
If I look in /var/spool/cron at my Raspberries, I see 'root' as owner for that folder.
Difference of owner causes problems:
see also
this disccusion (and similar) at StackOverflow.
Name 'pi' for that file relative to owner 'pi' is confusing.
Re: owner crontab
Posted: Tuesday 28 November 2017 22:13
by jannl
You do not choose the name of the cron file.
Re: owner crontab
Posted: Wednesday 29 November 2017 20:52
by curious
I changed the owner of this crontab to root, but it still doesn't run
The name of the file was automatically given. I think it is because I created it as user pi.
@toulon7559 : I will look at the link you provided
Re: owner crontab
Posted: Wednesday 29 November 2017 21:07
by jannl
Pi crontab is user pi and group crontab. Chmod settings are 600
How do you edit your crontab?
Besides that. I see the crontans directory has a very special bit set.
Re: owner crontab
Posted: Wednesday 29 November 2017 21:14
by curious
Editing is done by crontab -e
I don't know what you mean by "special bit set" , do I have to change something ?
Re: owner crontab
Posted: Wednesday 29 November 2017 21:32
by jannl
Not sure, basically it should work after a clean install.
The /var/spool/cron/crontabs is a special directory. Which shows when you do a ls -l in /var/spool/cron
My crontab of user pi
-rw------- pi crontab pi
Re: owner crontab
Posted: Thursday 30 November 2017 0:36
by Toulon7559
Looking at the output for ls -l in /var/spool/cron, agree with Janni that 'properties' are definitely not normal in that folder.
Code: Select all
pi@raspberrypi:/var/spool/cron$ ls -l
total 4
drwx-wx--T 2 root crontab 4096 Nov 24 11:11 crontabs
BTW, I use crontab -e to manage my cron
Re: owner crontab
Posted: Friday 01 December 2017 10:07
by curious
@jannl : do you mean a complete reinstall of the RPi (slik)
@toulon7559 : what do you mean by 'properties' (eigenschappen in Dutch isn't ?) are definitely not normal in that folder.
There is nothing but the pi file in that folder
When I do
the message is No such file or directory
Entering the complete folder-path : same message
Re: owner crontab
Posted: Sunday 03 December 2017 15:08
by curious
In the passed few days I managed to get the ownership of the cron back to user pi, and I was able to edit it with the usual command crontab -e
Today I learned that a crontab will not run when one of the lines has an error.
I commented the lines in the cron file and uncommented them one by one to find out which causes the problems
Actually I still don't get it but by changing the first part from */10 * * * * to */5 * * * * I now get the expected results.
@jannl and @toulon7559 thank you for your help.
Re: owner crontab
Posted: Sunday 03 December 2017 20:07
by Toulon7559
@Curious
My remark refers to seeing
A 'normal/simple' folder or file will have a property-string with rwx-combinations.