How to grant permission for cron job file?

I set the cron tab for my site. But I have a message in my inbox like "Permission denied" for a script. Can anyone help me tell me what could be the problem.

Thanks......

+3
source share
3 answers

Are you getting this error when setting up crontab? or from a script running from cron?

If you are installing crontab, try the following:

You enter: crontab -e You get: - bash: / usr / bin / crontab: Permission denied

Problem: Your user is not in the cron group.

. root, /etc/group, cron          ( ).          .

: "". "cron".

( http://www.parseerror.com/argh/crontab-e-Permission-denied.txt)

+7

, - ,

root: -

ls /usr/bin/crontab
chmod 4755 /usr/bin/crontab

echo PATH
vi /etc/crontab

SHELL=/bin/bash
PATH=/usr/java/jdk1.5.0_22/bin:/root/bin:/usr/java/jdk1.5.0_22/bin:/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
MAILTO=root
HOME=/

cd /etc/cron.d

cron.allow,

vi cron.allow
root
other username

su – username
/usr/bin/crontab -e

...................

+3

, , SSH. , SSH, , cron .

My solution was to create an additional key for this script without a passphrase (using ssh-keygen), install it on a remote server, and specify ssh commands in the script with the -i flag.

ssh -i /path/to/id_rsa.no-passphrase user@remote command-to-run
+3
source

Source: https://habr.com/ru/post/1708797/


All Articles