Interview's MateData Engineer
Interview's Mate

Data Engineer

SQL · Spark · Lakehouse · Streaming

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Data Engineer topics
Lesson 4/ 160
01. Data Engineering Foundations, Python & Linux

Cron Jobs, File Permissions, SSH & Process Management

Schedule jobs with cron, harden file permissions, connect via SSH, and manage long-running processes safely.

BeginnerCron · Permissions · SSH3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Define cadence, timezone, and catch-up policy. Next, scope user, umask, key, and file modes. Finally, supervise, alert, and inspect exit logs.

Think of it like…

Cron is the alarm clock, permissions are the locked doors, SSH is the key-card tunnel, and a process supervisor is the night manager who notices a stopped worker.

Where you’ve seen it

0 3 * * * UTC flock -n /var/run/revenue.lock /opt/etl/run.sh 2>&1 | logger -t revenue; an SSH key is chmod 600 and a restricted command key uses command="..." in authorized_keys.

Words you’ll hear

Cron
A daemon that starts commands using five time fields plus a sparse environment; cron is not a dependency-aware orchestrator.
Permissions
The owner/group/other read, write, and execute bits that should follow least privilege, often 0600 for keys and 0750 for scripts.
SSH
Encrypted remote command and file transport authenticated with a client public key and controlled by server policy.
Operational boundary
A cron job can run with a minimal PATH and different timezone, overlap yesterday's run, inherit an open secret file, or silently die after an SSH session closes. Use absolute paths, UTC or an explicit TZ, an exclusive lock such as flock -n, least-privilege modes, SSH BatchMode=yes, and a supervisor for services rather than background &.

Visual diagram

Loading interactive diagram

Theory & deep dive

Cron: the working mechanism

Cron supplies time-based starts, Unix modes control who can read or execute files, SSH provides authenticated remote access, and process supervision keeps jobs alive and observable.

Define cadence, timezone, and catch-up policy. Scope user, umask, key, and file modes, then lock overlapping runs and capture status; this exposes the state governed by SSH.

Cron Jobs, File Permissions, SSH & Process Management in one concrete design

0 3 * * * UTC flock -n /var/run/revenue.lock /opt/etl/run.sh 2>&1 | logger -t revenue; an SSH key is chmod 600 and a restricted command key uses command="..." in authorized_keys.

Key takeaway: Cron supplies time-based starts, Unix modes control who can read or execute files, SSH provides authenticated remote access, and process supervision keeps jobs alive and observable

Cron Jobs, File Permissions, SSH & Process Management: failure mode and production response

A cron job can run with a minimal PATH and different timezone, overlap yesterday's run, inherit an open secret file, or silently die after an SSH session closes.

Use absolute paths, UTC or an explicit TZ, an exclusive lock such as flock -n, least-privilege modes, SSH BatchMode=yes, and a supervisor for services rather than background &. Track Key mode as "0600 for a private SSH key", and make Lock visible to the dataset owner.

Key takeaway: Use absolute paths, UTC or an explicit TZ, an exclusive lock such as flock -n, least-privilege modes, SSH BatchMode=yes, and a supervisor for services rather than background &.

How it works, step by step

Step 1 of 4
Cron

1. Schedule

Define cadence, timezone, and catch-up policy. Cron supplies time-based starts, Unix modes control who can read or execute files, SSH provides authenticated remote access, and process supervision keeps jobs alive and observable.

define cadence, timezone, and catch-up policy
Key numbers at this step
Key mode
0600 for a private SSH key
Permissions
The owner/group/other read, write, and execute bits that should follow least privilege, often 0600 for keys and 0750 for scripts.

When to use it & trade-offs

What it is

Cron supplies time-based starts, Unix modes control who can read or execute files, SSH provides authenticated remote access, and process supervision keeps jobs alive and observable. 0 3 * * * UTC flock -n /var/run/revenue.lock /opt/etl/run.sh 2>&1 | logger -t revenue; an SSH key is chmod 600 and a restricted command key uses command="..." in authorized_keys.

Why it matters: A cron job can run with a minimal PATH and different timezone, overlap yesterday's run, inherit an open secret file, or silently die after an SSH session closes. Use absolute paths, UTC or an explicit TZ, an exclusive lock such as flock -n, least-privilege modes, SSH BatchMode=yes, and a supervisor for services rather than background &.

When to reach for it

  • Schedule jobs with cron, harden file permissions, connect via SSH, and manage long-running processes safely.
  • Choose Cron because it provides this capability: A daemon that starts commands using five time fields plus a sparse environment; cron is not a dependency-aware orchestrator.
  • Keep evidence for Key mode at "0600 for a private SSH key" so the last production stage-Recover - supervise, alert, and inspect exit logs-remains testable.

When to avoid or be careful

  • A cron job can run with a minimal PATH and different timezone, overlap yesterday's run, inherit an open secret file, or silently die after an SSH session closes.
  • Do not conflate Permissions with Cron. The second concept contributes different behavior: The owner/group/other read, write, and execute bits that should follow least privilege, often 0600 for keys and 0750 for scripts.
  • Release only after this guardrail is in place: Use absolute paths, UTC or an explicit TZ, an exclusive lock such as flock -n, least-privilege modes, SSH BatchMode=yes, and a supervisor for services rather than background &.

Cron / Permissions / SSH - roles, limits, and operating cost

Cron
Best for: A daemon that starts commands using five time fields plus a sparse environment; cron is not a dependency-aware orchestrator.

Strengths: A daemon that starts commands using five time fields plus a sparse environment; cron is not a dependency-aware orchestrator. Cron supplies time-based starts, Unix modes control who can read or execute files, SSH provides authenticated remote access, and process supervision keeps jobs alive and observable.

Watch out: A cron job can run with a minimal PATH and different timezone, overlap yesterday's run, inherit an open secret file, or silently die after an SSH session closes.

Permissions
Best for: The owner/group/other read, write, and execute bits that should follow least privilege, often 0600 for keys and 0750 for scripts.

Strengths: The owner/group/other read, write, and execute bits that should follow least privilege, often 0600 for keys and 0750 for scripts. In this workflow it supports: Execute - lock overlapping runs and capture status.

Watch out: The operating cost is real: one in-flight run per business interval.

SSH
Best for: Encrypted remote command and file transport authenticated with a client public key and controlled by server policy.

Strengths: Encrypted remote command and file transport authenticated with a client public key and controlled by server policy. Its output can be checked with Exit status.

Watch out: Operating guardrail: Use absolute paths, UTC or an explicit TZ, an exclusive lock such as flock -n, least-privilege modes, SSH BatchMode=yes, and a supervisor for services rather than background &.

Interview signals & numbers to know

When this topic comes up

  • “Where is the failure boundary for Cron, and how would Key mode reveal it?”
  • “Why is Permissions distinct from this behavior: encrypted remote command and file transport authenticated with a client public key and controlled by server policy?”
  • Production clue: A cron job can run with a minimal PATH and different timezone, overlap yesterday's run, inherit an open secret file, or silently die after an SSH session closes.
  • Design probe: Use absolute paths, UTC or an explicit TZ, an exclusive lock such as flock -n, least-privilege modes, SSH BatchMode=yes, and a supervisor for services rather than background &.

Benchmarks & rules of thumb

Key mode -
0600 for a private SSH key
Lock -
one in-flight run per business interval
Exit status -
cron mail or logger must retain non-zero task exits

Common mistakes & follow-ups

Common interview mistakes

  • A cron job can run with a minimal PATH and different timezone, overlap yesterday's run, inherit an open secret file, or silently die after an SSH session closes.
  • Reporting success from a job exit code without checking Key mode and Lock.
  • Treating this example as complete without replay, rollback, or access boundaries: 0 3 * * * UTC flock -n /var/run/revenue.lock /opt/etl/run.sh 2>&1 | logger -t revenue; an SSH key is chmod 600 and a restricted command key uses command="..." in authorized_keys.

Likely interviewer follow-ups

  • How would you prove this contract instead of only checking that the command ran: A daemon that starts commands using five time fields plus a sparse environment; cron is not a dependency-aware orchestrator.
  • What does the recovery plan do when this occurs? A cron job can run with a minimal PATH and different timezone, overlap yesterday's run, inherit an open secret file, or silently die after an SSH session closes.
  • When is Cron insufficient for Lock, and what does adding Permissions cost in Key mode?
Interview tip: Lead with the data path and failure boundary: Cron supplies time-based starts, Unix modes control who can read or execute files, SSH provides authenticated remote access, and process supervision keeps jobs alive and observable. Then make the answer operational: Use absolute paths, UTC or an explicit TZ, an exclusive lock such as flock -n, least-privilege modes, SSH BatchMode=yes, and a supervisor for services rather than background &.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Cron Jobs, File Permissions, SSH & Process Management with data engineer interview Q&A and hands-on practice.

Open Data Engineer Q&A →Machine Learning Q&A
Previous topic
Linux Fundamentals & Bash Scripting for Data Engineers
Next topic
Git Version Control, Branching Strategies & Code Reviews