"crontab -e"

Asked by RETENTION RANGE

Im denied access, when i run 'crontab -e' as a root, on ubuntu 16.04 SERVER,

msg i get "-bash: /usr/bin/crontab: Permission denied"

path /usr/bin/crontab, does not install my scripts,

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

What is the output of:

groups; ls -la /usr/bin/crontab; lsb_release -a; uname -a

Thanks

Revision history for this message
RETENTION RANGE (retention) said :
#2

 ls -la /usr/bin/crontab; " -rw- r--r-- 1 root root 1412 Mar 30 12:56 /usr/bin/crontab

lsb_release -a;
   No LSB modules available
   distrib: Id:Ubuntu
   Descrip:ubuntu 16.04.1 LTS
   Release: 16.04
   codename:xenial

uname -a;

linux retentionserver 4.4.0-66generic #87-Ubuntu SMP Fri Mar 3 15:29:05 UCT 2017 x86_64 x86_64

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Here is mine:

root@ubuntu-512mb-lon1-01:~# ls -la /usr/bin/crontab; echo
-rwxr-sr-x 1 root crontab 36080 Apr 5 2016 /usr/bin/crontab

root@ubuntu-512mb-lon1-01:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

Have you been messing with permissions on your server?

Revision history for this message
RETENTION RANGE (retention) said :
#4

yes, I thought the "Permission denied" message ,had something to do with permissions on my server.

Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#5

Then change the permissions on the command to match mine and it should be OK

Revision history for this message
RETENTION RANGE (retention) said :
#6

now my::::
ls -la /usr/bin/crontab;
    -rwxr-xr-x 1 root root 1412 March 30 12:56 /usr/bin/crontab

and ''crontab -e" gives no output, it jst open the next new line on the cmd

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#7

It's group isn't crontab and it's not sticky. Check your output compared to mine......

Revision history for this message
RETENTION RANGE (retention) said :
#8

i matched group and sticky bit,now :~# ls -la /usr/bin/crontab;echo
          -rwxr-sr-x 1 root 1412 March 30 21:35 /usr/bin/crontab

do i also need to match ''1412'' to ''36080'',if so assist me?

note--:~# crontab -e; echo no output,it just takes me to next line on terminal.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#9

The number is the IO block size apparently. Could try:

sudo apt-get clean
sudo apt-get update
sudo apt-get install --reinstall install cron

To overwrite the binary.

Revision history for this message
Manfred Hampl (m-hampl) said :
#10

Please pay attention that /usr/bin/crontab can be provided by different packages (bcron-run, cron, systemd-cron) and they all have different size (and maybe also different file protection settings).

What is the output of the command
ls -l /var/spool/cron/crontabs

Revision history for this message
RETENTION RANGE (retention) said :
#11

~ # sudo apt-get clean; ~ # sudo apt-get update; the both echoes the following;

E:Could not get lock /var/lib/apt/list/lock – open (11:Resources temporarily unavavilable)
E:Unable to lock directory /var/lib/apt/lists/

 So i will give feedback after cleaning,updating and inst/reinstall cron,

~ # ls -l /var/spool/cron/crontabs ;
            -rwxr-xr-x 1 root 1406 March 30 13:29 root

Revision history for this message
RETENTION RANGE (retention) said :
#12

Thanks actionparsnip, that solved my question.

Revision history for this message
RETENTION RANGE (retention) said :
#13

~ # sudo apt-get clean; ~ # sudo apt-get update; the both echoes the following;

E:Could not get lock /var/lib/apt/list/lock – open (11:Resources temporarily unavavilable)
E:Unable to lock directory /var/lib/apt/lists/

Revision history for this message
Manfred Hampl (m-hampl) said :
#14

The message

E:Could not get lock /var/lib/apt/list/lock – open (11:Resource temporarily unavailable)

usually is caused by the fact, that there is another package management process running (either an GUI-program like update-manager, software-center, Ubuntu-software or synaptic or a command-line oriented one such as apt or apt-get).

You can check with
sudo fuser -vvv /var/lib/dpkg/lock
which process that is.

Revision history for this message
Manfred Hampl (m-hampl) said :
#15

Minor correction of my last comment:
In your case, if the error message is about /var/lib/apt/lists/lock, the command of course has to be

sudo fuser -vvv /var/lib/apt/lists/lock

Revision history for this message
RETENTION RANGE (retention) said :
#16

@ actionparsnip thanks a lot for your help,it meant a lot,

after ~ # sudo apt-get clean; ~ # sudo apt-get update;

~ # crontab -e ; opened, and it is now working

@Manfred Hampl (m-hampl) thank u too! for your contribution,

Revision history for this message
RETENTION RANGE (retention) said :
#17

Thanks actionparsnip, that solved my question.