Errors / checked October 9, 2026

/bin/sh: 1: /home/you/job.sh: Permission denied

The error

Mail or log output of a crontab job on Debian or Ubuntu that runs a script by its path. The job exits with status 126.

Quick fix

  1. Make the script executable: chmod +x /home/you/job.sh. Check with ls -l: the line should start with -rwx.
  2. Or call the interpreter and pass the script, which needs no execute bit: /bin/bash /home/you/job.sh.
  3. Check that every directory on the path can be entered by the crontab's user (the x bit on each folder), and that the script is not on a filesystem mounted noexec, such as /tmp on some servers.

Replace a crontab curl line with a hosted schedule

Why this happens

cron runs each job line with /bin/sh. When the line is a path to a file, the kernel has to execute that file, and it refuses when the file has no execute permission for the user that owns the crontab, when a directory on the way is closed to that user, or when the filesystem is mounted noexec. dash reports all three as "Permission denied" and the shell exits with 126.

Other solutions

  • A root crontab and a user crontab run as different users: a script that works from sudo crontab -e can fail in your own crontab, and the reverse.
  • If the script only calls a URL in your app, a hosted scheduler can call it instead, with no script, permissions or server to manage. RunLater retries failures and keeps the response of every run.

Check a schedule before you deploy it: the cron expression explainer shows the next 10 run times.

Frequently asked questions

What does exit code 126 mean in cron?

The command was found but could not be executed, usually because the file is not executable for that user. "not found" is 127.

My script runs with bash job.sh but not from cron. Why?

bash job.sh reads the file as input and only needs read permission. Running ./job.sh or its full path executes the file, which needs the execute bit.

I ran chmod +x and still get Permission denied. What else?

Check the directories on the path (each needs x for that user) and whether the filesystem is mounted noexec (mount | grep noexec). Calling /bin/bash /path/job.sh works around both the execute bit and noexec.

Have the URL called on schedule, with retries

RunLater calls your URL on a cron schedule or at an exact time, in your timezone, retries failed calls with backoff and logs each response, so a timeout or a 5xx shows up in a log instead of disappearing.

Start a 14-day trialStarter is $15/month for 250 scheduled requests and 25,000 runs. Cancel before day 14 and you pay nothing.

Related errors