owner crontab

Moderator: leecollings

Post Reply
curious
Posts: 132
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

owner crontab

Post 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 ?
Toulon7559
Posts: 858
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: owner crontab

Post 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.
Last edited by Toulon7559 on Tuesday 28 November 2017 22:50, edited 1 time in total.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
jannl
Posts: 673
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: owner crontab

Post by jannl »

You do not choose the name of the cron file.
curious
Posts: 132
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

Re: owner crontab

Post 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
jannl
Posts: 673
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: owner crontab

Post 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.
curious
Posts: 132
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

Re: owner crontab

Post 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 ?
jannl
Posts: 673
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: owner crontab

Post 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
Toulon7559
Posts: 858
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: owner crontab

Post 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
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
curious
Posts: 132
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

Re: owner crontab

Post 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

Code: Select all

 /var/spool/cron$ ls -l 
the message is No such file or directory
Entering the complete folder-path : same message
curious
Posts: 132
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

Re: owner crontab

Post 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.
Toulon7559
Posts: 858
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: owner crontab

Post by Toulon7559 »

@Curious

My remark refers to seeing

Code: Select all

drwx-wx--T
A 'normal/simple' folder or file will have a property-string with rwx-combinations.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests