/usr/bin/crontab permissions are wrong. Please set to 4755

Lucas

Well-Known Member
Feb 22, 2003
132
3
168
Around the world
cPanel Access Level
Root Administrator
Could someone explain me why would cPanel change the permissions of crontab incorrectly? I had fixed them and on the update they got messed up again. Is this a bug or is there something wrong on my server?

/usr/bin/crontab permissions are wrong. Please set to 4755
 

natong

Well-Known Member
May 17, 2008
89
1
58
I faced this problem too.
It's CentOS 5 and cPanel bug 6 months ago.


To fix these, run

chmod 4755 /usr/bin/crontab

from the command line as root.
 
Last edited:

natong

Well-Known Member
May 17, 2008
89
1
58
by the way, I still get the problem.

$ crontab -l
cron/taoto: Permission denied
 
Last edited:

natong

Well-Known Member
May 17, 2008
89
1
58
Found solution:

chmod 4775 /usr/bin/crontab

After run those command, check permission of /var/spool/cron and user owner permission files too.

They should be:

root 04:00:15 AM /var/spool/cron 900 # ls -al
total 24
drwxr-xr-x 2 root root 4096 Jun 5 03:41 ./
drwxr-xr-x 12 root root 4096 May 23 22:53 ../
-rw------- 1 root root 1394 Jun 4 12:04 mailman
-rw------- 1 root root 385 Jun 5 00:47 root
-rw------- 1 taoto taoto 154 Jun 5 03:38 taoto
-rw------- 1 thumb thumb 51 Jun 5 03:41 thumb
 
Last edited:

natong

Well-Known Member
May 17, 2008
89
1
58
When user use cPanel to add cron job, system reset owner of /var/spool/cron/* to root

Then user can't use command line "crontab -l".

Sometime system also reset permission of folder /var/spool/cron/ to drwx------


root 03:22:59 AM /var/spool/cron 1015 # ls -l

drwxr-xr-x 2 root root 4096 Jun 8 03:22 ./
drwxr-xr-x 12 root root 4096 May 23 22:53 ../
-rw------- 1 root root 1394 Jun 7 00:49 mailman
-rw------- 1 root root 385 Jun 8 00:47 root
-rw------- 1 root taotoo 101 Jun 8 03:22 taotoo
-rw------- 1 thumbno thumbno 51 Jun 5 03:41 thumbno
I add bug report to
http://bugzilla.cpanel.net/show_bug.cgi?id=6373
 

Garry-UK

Member
Jul 18, 2004
16
0
151
Hi,

I was having problems with this as well cPanel users was not able to create a cron, but after running: chmod 4755 /usr/bin/crontab
It fixed the problem. I am running:

WHM 11.23.2 cPanel 11.23.4-R26138
CENTOS Enterprise 5.2 x86_64 on virtuozzo - WHM X v3.1.0
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
cPanel Access Level
Root Administrator
cPanel does not modify the permissions of the crontab binary.

Even if your permissions on /var/spool/cron are set to 0700, a normal user in a normal shell should be able to modify and display his own crontab from the command line.

Tested on CentOS 4.6 and FreeBSD 7 (display below is from CentOS, however permissions are the same on the FreeBSD server).

Code:
[email protected] [~]# ls -l /usr/bin/crontab 
-rwsr-xr-x  1 root root 82916 Aug  2  2007 /usr/bin/crontab*
[email protected] [~]# ls -l /var/spool/cron
total 36
drwx------   2 root root     4096 Jul 30 13:15 ./
drwxr-xr-x  17 root root     4096 Mar  2  2007 ../
-rw-------   1 root root     1430 Jul 17 15:40 mailman
-rw-------   1 root mysqlbug   10 Dec  7  2006 mysqlbug
-rw-------   1 root root      496 Jul 30 09:37 root
-rw-------   1 root root       87 Jul 30  2007 standard
-rw-------   1 root abcdee    318 Jul 30 13:15 tramel
[email protected] [~]# su - tramel
[email protected] [~]# echo $SHELL
/bin/bash
[email protected] [~]# crontab -l
MAILTO="tramel"
0 0 * * * echo "Test the 6th" >> /tmp/cptest
0 5 * * * echo "Test the 5th" >> /tmp/cptest
0 4,8,12,22 * * * echo "mimi" >> /dev/null
0 0 * * * echo "hi test me" > /tmp/cptest
0 3 * * * echo "Another test" >> /tmp/cptest
0 3 * * * echo "Test the 4th" >> /dev/null
[email protected] [~]# crontab -e
crontab: installing new crontab
[email protected] [~]# crontab -l
MAILTO="tramel"
0 0 * * * echo "Test the 6th" >> /tmp/cptest
0 5 * * * echo "Test the 5th" >> /tmp/cptest
0 4,8,12,22 * * * echo "mimi" >> /dev/null
0 0 * * * echo "hi test me" > /tmp/cptest
0 3 * * * echo "Another test" >> /tmp/cptest
0 3 * * * echo "Test the 4th" >> /dev/null
0 0 * * * echo "CLI Test" >> /dev/null
[email protected] [~]# logout

If something keeps changing the permissions of /usr/bin/crontab then you need to hunt down what is causing that change.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
cPanel Access Level
Root Administrator
This happened for me on a new install. I don't know if crontab permissions change, they were just wrong to start with.
Correct. /usr/bin/crontab gets installed non-setuid by the distro, but cPanel wants the permissions to be setuid, likely because of applying 0700 permissions to /var/spool/cron
 

Babylon

Member
Aug 8, 2003
17
0
151
Anyone able to help further with this? I tried the noted solutions above, however:

crontab -l
cron/root: Permission denied


Running CentOS 5 here as well.

Edit: nevermind. I had to chown root:root /usr/bin/crontab

Then chmod 4755 /usr/bin/crontab
 
Last edited: